home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / a68k104.arc / A68K104.MAN next >
Encoding:
Text File  |  1987-03-18  |  196.4 KB  |  6,269 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  _______________________________________________________________  
  13.                                                                  
  14.               Advance Operating System User Manual
  15.  
  16.                   Last Revised  April, 1987
  17.  _______________________________________________________________ 
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.      The  Advance  Operating System is distributed as  a  USEware 
  37. product.   Creative Software Technology assumes no responsibility 
  38. for any errors that may appear in this manual.  Creative Software 
  39. Technology,  reserves the right to make changes in specifications 
  40. and other information contained in this user manual without prior 
  41. notice,  and  the  reader  should in all cases  consult  Creative 
  42. Software  Technology to determine whether any such  changes  have 
  43. been  made.   The  Advance Operating System is  the  property  of 
  44. Creative Software Technology.   Use, duplication or disclosure is 
  45. subject  to restrictions stated in Creative Software Technology's 
  46. Binary Software License Agreement.
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.                     ADVANCE OPERATING SYSTEM
  83.  
  84.                   Copyright (C) 1986, 1987 by: 
  85.                   Creative Software Technology
  86.  
  87.                        All Rights Reserved
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.                         TABLE OF CONTENTS
  138.  
  139.  
  140. Chapter 1.  Introduction to the Advance Operating System.....1-1
  141.  
  142.      1.1  General Features...................................1-4
  143.      1.2  AOS/68K Entry Vectors..............................1-8
  144.      1.3  Interrupts.........................................1-9
  145.      1.4  Configuration Table...............................1-10
  146.      1.5  Static Task Control Block.........................1-17
  147.      1.6  Task Priorities...................................1-19
  148.      1.7  Task States.......................................1-20
  149.      1.8  The Balanced System Design........................1-21
  150.  
  151. Chapter 2.     AOS System Calls (Part One)...................2-1
  152.  
  153.      2.1.0     Tsk_switch....................................2-4
  154.      2.1.1     Tsk_on........................................2-5
  155.      2.1.2     Tsk_off.......................................2-6
  156.      2.1.3     Tsk_stat......................................2-7
  157.      2.1.4     Tsk_id........................................2-8
  158.      2.2.1     Post_box......................................2-9
  159.      2.2.2     Send.........................................2-12
  160.      2.2.3     Receive......................................2-14
  161.      2.2.4     Sendx........................................2-16
  162.      2.3.1     Time_set.....................................2-18
  163.      2.3.2     Time_read....................................2-19
  164.      2.3.3     Tick.........................................2-20
  165.      2.3.4     Delay........................................2-21
  166.      2.4.1     Put_char.....................................2-22
  167.      2.4.2     Get_char.....................................2-23
  168.      2.4.3     Key_stat.....................................2-24
  169.      2.4.4     Trn_stat.....................................2-26
  170.      2.5.1     Gt_cpt.......................................2-27
  171.      2.5.2     G_stk........................................2-27
  172.      2.5.3     Res_tsk......................................2-28
  173.  
  174. Chapter 3.     AOS System Calls (Part Two)...................3-1
  175.  
  176.      3.1.1     Fetch_mem.....................................3-1
  177.      3.1.2     Release_mem...................................3-2
  178.      3.1.3     Free_mem......................................3-3
  179.      3.2.1     Edc_system....................................3-4
  180.      3.2.2     Edc_task......................................3-5
  181.  
  182. Chapter 4.     Error Recovery Interface Software.............4-1
  183.  
  184.      4.1       Error Analysis................................4-2
  185.      4.2       Error Correction Word.........................4-3
  186.  
  187. Chapter 5.     Interactive Diagnostic Module.................5-1
  188.  
  189. APPENDIX       Execution Times...............................A-1
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199. Advance Operating System                                Chapter 1
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207. 1.0  INTRODUCTION
  208.  
  209.      Congratulations  on  choosing the ADVANCE OPERATING  SYSTEM!  
  210. This  version  of ADVANCE is one of  the  fastest,  position  and 
  211. device independent,  multitasking operating systems available for 
  212. the 68000.   In many instalations this version of ADVANCE for the 
  213. 68000 will be THE fastest.   Many system designers  choose slower 
  214. operating  systems because they claim to run "real-time" and they 
  215. have  been  around  for  awhile.    If  speed,  reliability,  and 
  216. efficiency are your main concerns in the design of your  embedded 
  217. 68000  processor  application,  then you have made  an  excellent 
  218. choice in choosing ADVANCE.
  219.  
  220.  
  221.      We  have  sacrificed  very little versatility  in  order  to 
  222. create ADVANCE.  You will find the functions you need and use the 
  223. most  in multitasking operating systems such as task  management, 
  224. the ability to set up time-slicing,  and intertask communication, 
  225. etc.  Every system call has been engineered for the 68000, making 
  226. full use of it's powerful architecture.  ADVANCE system calls are 
  227. easy  to set up and use in a wide variety of  applications.   Our 
  228. basic calls can be combined with application algorithms in such a 
  229. way  as  to lessen the need for the expensive scheme  of  dynamic 
  230. task prioritization and special time-slicing.*
  231.  
  232.  
  233.      The ADVANCE OPERATING SYSTEM is offered in three parts, each 
  234. sold separately.   Part One is the base-section.   Intertask syn-
  235. chronization,  management,  communication  and all the  necessary 
  236. software  to support a fast multitasking kernel is in  Part  One.  
  237. Part  Two  contains the structured AOS Error  Recovery  Interface 
  238. software.  If your application will be detecting run-time errors, 
  239. the AOS ERI package can significantly increase system efficiency.  
  240. Part  Three is the AOS Interactive Diagnostic Module.   This spe-
  241. cial software will decrease the amount of time it takes  program-
  242. mers  to debug their code.   The three parts are organized in the 
  243. following manner:
  244.  
  245.                        Part        Chapter
  246.  
  247.                          1            2
  248.                          2            4
  249.                          3            5
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259. Copyright (C) 1986, 1987 by Creative Software Technology      1-1
  260.  
  261.  
  262.  
  263.  
  264.  
  265. Advance Operating System                                Chapter 1
  266.  
  267.  
  268.  
  269.  
  270.  
  271.      The  ADVANCE  Operating  System  was created  to  control  a 
  272. variety of sophisticated production equipment.   A machine super-
  273. vised  by ADVANCE is up to 50% more efficient than  an  identical 
  274. machine with a standard operating system.   ADVANCE significantly 
  275. increases  product throughput.   Many hours of run-time in  manu-
  276. facturing  plants are constantly proving the superior performance 
  277. of ADVANCE-operated equipment.                       
  278.  
  279.  
  280.      The  optional Error Recovery (ERI) interface software in the 
  281. ADVANCE  Operating  System is  very  powerful.   ADVANCE-operated 
  282. equipment  equipped with ERI can easily and quickly recover  from 
  283. many  former  "machine-down" error conditions with  it's  unique, 
  284. structured  error recovery data tables.   Many other  errors  can 
  285. safely  be  masked and scheduled into a more timely  preventative 
  286. maintenance  schedule.   This  Error  Recovery  Software  permits 
  287. higher throughput,  which is just one of many AOS Balanced System 
  288. Design benefits.
  289.  
  290.  
  291.      ADVANCE  supports structured modular  programming.   Compli-
  292. cated  processes may be broken down into small  parts  (modules).  
  293. These  smaller sections are easier to understand and maintain for 
  294. the entire useful life of your process applications.  The modular 
  295. design concept behind ADVANCE allows the applications engineer to 
  296. solve complex, parallel control processes that could be solved no 
  297. other way.
  298.  
  299.  
  300.      ADVANCE,  equipped with the optional Interactive  Diagnostic 
  301. Module  (IDM),  makes  debugging  of hardware and  software  much 
  302. easier,  and works very well with logic analyzers.   ADVANCE, for 
  303. most applications,  makes logic analyzers unnecessary because  it 
  304. can  easily simulate hardware events on the diagnostic  terminal.  
  305. This  simulation  makes real hardware bugs easy to locate  during 
  306. integration testing.   Also,  diagnostic programs can run  simul-
  307. taneously  with user programs,  giving the programmer an  "inside 
  308. view"  of  his software as it runs (a powerful debugging  tool!).  
  309. Unlike typical diagnostics,  ADVANCE's IDM allows for breakpoints 
  310. that stop only the module that hits a breakpoint, while the other 
  311. modules continue to run.
  312.  
  313.  
  314.      This version of the ADVANCE OPERATING SYSTEM is designed  to 
  315. run  on a 68000-based microcomputer.   ADVANCE/68000 is very much 
  316. like  a hardware component.   It never needs to be  modified  for 
  317. special  68000 designs.  This means that the system architect can 
  318. easily  build  an endless number of software designs  around  AOS 
  319. without ever changing it.
  320.  
  321.  
  322.  
  323.  
  324.  
  325. Copyright (C) 1986, 1987 by Creative Software Technology      1-2
  326.  
  327.  
  328.  
  329.  
  330.  
  331. Advance Operating System                                Chapter 1
  332.  
  333.  
  334.  
  335.  
  336.      The  ADVANCE  OPERATING SYSTEM is position  independent  and 
  337. occupies  a  4K ROM space in the target  microcomputer's  memory, 
  338. just  in  front of a user-supplied  configuration  table.  Please 
  339. refer to section 1-3 for information on how to set up the config-
  340. uration table.   The user configuration table has various  pieces 
  341. of  information in it such as a pointer to RAM,  how much RAM  is 
  342. available at that location, etc.  Also, ADVANCE can run correctly 
  343. anywhere  in  the target microcomputer's decoded  address  space, 
  344. except over the 68000 interrupt vectors, etc.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355. _________________________________________________________________
  356.  
  357.  
  358.      * System designers pay dearly in terms of system  efficiency 
  359. for the ability over-control tasks.   On most mainframes not many 
  360. people  care about the very small amount of time it takes to load 
  361. individual  times for individual tasks in a task time-out  timer.  
  362. This occurs during the dispatch of each and every active task  in 
  363. a  mainframe's  dynamic  process queue.   In an  embedded  micro-
  364. processor  in a missile,  on its way to its target,  many  people 
  365. care.   Constantly processing a task's relative priority in ever-
  366. changing, real-world conditions is inefficient in many processes.  
  367. Just  when everybody is sure of the exact priority of each of  20 
  368. tasks,  a  low priority,  error recovery task  desperately  needs 
  369. scheduling.  The system fails because not enough testing was done 
  370. to  determine that the prioritys were not correct for an  instant 
  371. in time.   Extensive stack checking, dynamic task-prioritization, 
  372. and  special  time-slicing add up to 200+% extra processing  time 
  373. per  task switch.   A more efficient design methodology is  based 
  374. upon  the  ADVANCE OPERATING SYSTEM's  "Balanced  System  Design" 
  375. where tasks are assigned equal priorities (see section 1.6).
  376.  
  377.      Sometimes  it  is too late to do anything  meaningful  about 
  378. speeding up a system once all the code is in place.   Quite often 
  379. the problem with real-time, multitasking applications is not just 
  380. the  application  code but the operating system  "kernel."   Once 
  381. system  designers  realize that the application  code  cannot  be 
  382. optimized  further they look at the operating system wishing they 
  383. had left out all non-essential features.   Once an application is 
  384. written it becomes exceedingly hard to trim code from the  multi-
  385. tasking operating system kernel.
  386.  
  387.  
  388.  
  389.  
  390.  
  391. Copyright (C) 1986, 1987 by Creative Software Technology      1-3
  392.  
  393.  
  394.  
  395.  
  396.  
  397. Advance Operating System                                Chapter 1
  398.  
  399.  
  400. 1.1  GENERAL FEATURES
  401.  
  402.  
  403. 1.1.1 MULTITASKING CAPABILITIES
  404.  
  405.      ADVANCE  was  designed to be used in real-time  controllers.  
  406. Therefore, multitasking software "overhead" has been trimmed to a 
  407. minimum.  This trimming in no way decreases performance, however, 
  408. and  many  powerful functions are available to  the  applications 
  409. programmer.   ADVANCE  allows  the engineer at assembly  time  to 
  410. select either multitasking or straight-line processing.   He  can 
  411. easily  change the number of modules while debugging his program, 
  412. or  even go back to straight-line processing.   One  process  can 
  413. even turn on or off another concurrent process.
  414.  
  415.  
  416. 1.1.2 MODULAR ARCHITECTURE
  417.  
  418.      Figure 1-1  depicts   the      --------------------------  
  419. structure  of  ADVANCE.    The     |         Advance          | 
  420. system resides in a 4K kernal.     |        Operating         |  
  421. Parallel  tasks,  or  modules,     |         System           | 
  422. are simply plugged into  place     |   --------------------   | 
  423. as  they  are  needed.    This     |  |        ERI         |  | 
  424. modular  scheme allows the ap-     |   --------------------   |
  425. plications  engineer to  solve     |   --------------------   | 
  426. problems  involving   complex,     |  |      TASK #1       |  | 
  427. parallel   control  processes.     |   ------        ------   |  
  428. During the design  period,  he     |        |        |        | 
  429. simply  divides machine  tasks     |   ------        ------   | 
  430. by  location and function into     |  |      TASK #2       |  | 
  431. individual processes.   He can     |   ------        ------   | 
  432. then  quickly  spot   parallel     |        |        |        | 
  433. processes  and  separate  them     |   ------        ------   | 
  434. into simple modules.               |  |      TASK  N       |  |
  435.                                    |   --------------------   |
  436.      The Error Recovery Inter-     |   --------------------   |
  437. face (ERI) software is part of     |  |        IDM         |  | 
  438. a  supervisory  module,  shown     |   --------------------   | 
  439. here to illustrate the  entire     |                          | 
  440. ADVANCE fault tolerant system.      -------------------------- 
  441.  
  442.                                                 Fig. 1-1
  443.                                           Structure of ADVANCE
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457. Copyright (C) 1986, 1987 by Creative Software Technology      1-4
  458.  
  459.  
  460.  
  461.  
  462.  
  463. Advance Operating System                                Chapter 1
  464.  
  465.  
  466. 1.1.3 TASK COMMUNICATION
  467.  
  468.      ADVANCE supports an inter-task communication system.   Three 
  469. basic  functions  control a powerful message  passing  technique.  
  470. The  "mailbox"  system is designed to work well with  high  level 
  471. language  design.   The  internal ADVANCE "post office"  software 
  472. organizes all task mailboxes.    Some tasks may want to be turned 
  473. on  only  if  they  receive a message  from  a  particular  task.  
  474. ADVANCE  checks  to see if the calling task is the one  that  the 
  475. receiving task wants to be activated for.  If the receiving  task 
  476. is  not  active,  and  wants to be activated by a  certain  task, 
  477. ADVANCE  activates the target task.
  478.  
  479.      Each application task has complete control over its mailbox.  
  480. If  a task must wait for a command from another task in order  to 
  481. execute some code,  for instance, they can de-activate themselves 
  482. until  they get "command" mail from another task.   If a task can 
  483. run without waiting on an external command message,  ADVANCE lets 
  484. the  task monitor its own mail flag for new "letters"  while  the 
  485. task does some other processing.  Also, individual task mailboxes 
  486. can  each  hold from a single message pointer to as many  message 
  487. pointers  as there are registered tasks.   A task can  have  many 
  488. mailboxes, one registered mailbox active at any time.
  489.  
  490.  
  491. 1.1.4 REAL-TIME CONTROL
  492.  
  493.      Unlike  some multitasking systems that claim to  run  "real-
  494. time,"  the  ADVANCE OPERATING SYSTEM services  real-time  events 
  495. with tremendous speed.   Fast and efficient control of peripheral 
  496. devices  by a computer depends on the wise use of interrupt  pro-
  497. gramming.  Most systems available on the market today take two to 
  498. ten  times  longer  than  ADVANCE to do  simple  task  switching.  
  499. ADVANCE's  dispatcher can change environments (do a task  switch) 
  500. on  an  8-MHZ 68000-based system in less  than  80  microseconds.  
  501. Most popular 8-bit or pseudo 16-bit microprocessors (running at 1 
  502. MHZ)  using ADVANCE will typically service each module of a  six-
  503. module  program  once every 750 microseconds.   This estimate  is 
  504. based on the average piece of production machinery equipped  with 
  505. ADVANCE  task-switching  algorithms on the field  right  now.   A 
  506. faster  processor,  of  course,  will respond even more  rapidly.  
  507. This  type of performance means that your processor can run  sev-
  508. eral  concurrent tasks and  directly operate stepping  motors  -- 
  509. even manage sensor-driven mechanical equipment -- without a slave 
  510. processor.  This means much savings in hardware expense.
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523. Copyright (C) 1986, 1987 by Creative Software Technology      1-5
  524.  
  525.  
  526.  
  527.  
  528.  
  529. Advance Operating System                                Chapter 1
  530.  
  531.  
  532. 1.1.5 EASY MAINTENANCE
  533.  
  534.      Because  the ADVANCE OPERATING SYSTEM is modular,  engineers 
  535. can   break  large  functions  into   smaller   modules.    Huge, 
  536. complicated  tasks that normally end up being impossible for  the 
  537. user  to  understand  are broken down  into  logical  partitions.  
  538. These  smaller  sections are naturally easier to  understand  and 
  539. maintain  for  the entire useful life of the  application.   This 
  540. means much lower maintenance costs for the end-user,  a  valuable 
  541. selling feature in product bulletins.
  542.  
  543.  
  544. 1.1.6 HIGHER EFFICIENCY
  545.  
  546.      For  several  reasons ADVANCE-operated equipment has  higher 
  547. throughput.   Many  serial processes can "overlap" each other  or 
  548. even run concurrently in a multitasking operating  system.   This 
  549. restructuring  speeds up the overall process significantly.   The 
  550. concurrent  processing feature works together with  the  optional 
  551. Error  Recovery  Interface  (ERI) feature to smooth  out  erratic 
  552. process variables.   These two features,  combined together, pro-
  553. duce  economical  machine  operation (such  as  scheduling  small 
  554. errors into a more timely preventative maintenance schedule).
  555.  
  556.  
  557. 1.1.7 HARDWARE SIMULATION SUPPORT
  558.  
  559.      ADVANCE  is  structured  so that the programmer can  make  a 
  560. model  of the final application environment,  running the  actual 
  561. software  but  simulating  hardware  events  on  the   diagnostic 
  562. terminal.   Real  hardware bugs thus become easy to locate during 
  563. integration testing.   Critical timing paths of complex processes 
  564. can  be  simulated prior to  actual  mechanical  movement.   This 
  565. simulation  helps to protect machinery from damage from  software 
  566. errors during debugging.
  567.  
  568.  
  569. 1.1.8 FIELD-TESTED
  570.  
  571.      The  ADVANCE OPERATING SYSTEM is working in the field today, 
  572. with  thousands  of hours of run time on  it  already.   Original 
  573. ADVANCE OPERATING SYSTEM components, such as the dispatch system, 
  574. Error Recovery System,  Interactive Diagnostic Module, etc., have 
  575. hundreds of thousands of hours of actual run-time in a variety of 
  576. process-control applications.  This code has also been tested and 
  577. used  in medical imaging equipment,  telecommunications  systems, 
  578. data acquisition systems,  educational systems,  and video games.  
  579. Most engineers now using the original ADVANCE software components 
  580. are  very  impressed by its efficiency.   Machine "down-time"  is 
  581. significantly reduced.   Combinations of asynchronous errors that 
  582. could  not  be planned for are smoothly  and  quickly  corrected.  
  583. Repair  crews  appreciate  this system because it  corrects  most 
  584. intermittent  errors  in ADVANCE-operated equipment  unless  they 
  585. become mechanical or electrical "hard" failures. 
  586.  
  587.  
  588.  
  589. Copyright (C) 1986, 1987 by Creative Software Technology      1-6
  590.  
  591.  
  592.  
  593.  
  594.  
  595. Advance Operating System                                Chapter 1
  596.  
  597.  
  598. 1.1.9 COMPARISON BETWEEN TWO OPERATING SYSTEMS
  599.  
  600.      Suppose we have to choose between two multitasking operating 
  601. systems.   Lets say that Brand A has similar features to Brand V.  
  602. Both have task management,  inter-task communication and synchro-
  603. nization,  real time clock,  memory allocation, and etc.  Brand A 
  604. does a task switch in less than 80 microseconds and Brand V  does 
  605. a task switch in 106 microseconds.  Brand V has more control over 
  606. the switching of tasks at the expense of 26 microseconds of time.  
  607.  
  608.      Suppose we have a multitasking application that incorporates 
  609. 10 tasks,  with any 5 of those tasks in the active dispatch queue 
  610. at any given moment.   How long will it take for the processor to 
  611. stop  processing a certain communication task,  process the other 
  612. tasks,  and return to the original communication task?  Let's use 
  613. Brand A and Brand V for our analysis:
  614.  
  615.                     Five Task Cycle Time =
  616.  
  617.   ( T1 + disp + T2 + disp + T3 + disp + T4 + disp + T5 + disp )
  618.  
  619. As  you can see,  the dispatch overhead is multiplied  times  the 
  620. number of active tasks,  in this case, five tasks.  In Brand A we 
  621. will  get  back  to our original task 21us times  the  number  of 
  622. active tasks (over 100us) faster than Brand V.  In many real-time 
  623. applications an average task can do its average processing (using 
  624. an  8 MHZ 68000) in 80us (or thereabouts).   If we multiply  80us 
  625. per  task times 5 tasks we have 400us (plus dispatch time of  say 
  626. 85us times 5 tasks = 425us) plus 425us overhead.   This totals to 
  627. 825us  cycle  time for Brand A.   Brand V would  add  over  100us 
  628. baggage to every five-task cycle:
  629.  
  630.           T1     T2     T3     T4     T5     TOTALS:
  631.  
  632. Process:  80     80     80     80     80      400us
  633. Switch
  634. tasks:    80     80     80     80     80      400us
  635.  
  636.             Total Brand A 5-task cycle time:  800us
  637. Brand V
  638. baggage:  26     26     26     26     26      130us
  639.  
  640.             Total Brand V 5-task cycle time:  930us
  641.  
  642.      In applications that are not as real-time intensive, such as 
  643. a  group of users on a mainframe,  the extra "baggage" difference 
  644. between  the  two brands is less  significant.   There  are  many 
  645. multitasking  operating  systems,  however,  where  you  want  to 
  646. squeeze  every microsecond you possibly can out of the processor: 
  647. high-speed telecommunications,  missiles,  process control, real-
  648. time expert systems, etc.  Many experienced system designers will 
  649. sacrifice  a  little extra task control for a greater  amount  of 
  650. improvement in system speed and efficiency.
  651.  
  652.  
  653.  
  654.  
  655. Copyright (C) 1986, 1987 by Creative Software Technology      1-7
  656.  
  657.  
  658.  
  659.  
  660.  
  661. Advance Operating System                                Chapter 1
  662.  
  663.  
  664. 1.2  AOS/68K ENTRY VECTORS
  665.  
  666.      There  are four entry points into AOS.  These  entry  points 
  667. provide  the necessary "hooks" into the ADVANCE OPERATING  SYSTEM 
  668. for  user  programs.   There  are some precautions that  must  be 
  669. observed when using the major AOS/68K entry points.   Here, then, 
  670. is some very important information concerning these vectors.
  671.  
  672.  
  673. 1.2.0    Entry ZERO
  674.  
  675.      Entry  ZERO  is at the top of AOS.   This  is  the  starting 
  676. location of AOS.   The application's startup code simply jumps to 
  677. the  beginning  of the 4K ROM to turn control over to  AOS.   The 
  678. 68000  processor must first be in the supervisor state  prior  to 
  679. jumping  to  AOS Entry ZERO.   Provide a minimum of 256 bytes  of 
  680. system stack space for initialization and AOS system call  usage.  
  681. If  there  will be nested levels of  interrupts  then  additional 
  682. system  stack  space may be required.   The minimum 256 byte  ram 
  683. requirement  is  in addition to the total ram  specified  in  the 
  684. configuration table parameter RAMSIZE (see section 1.4).
  685.  
  686.  
  687. 1.2.1    Entry  ONE
  688.  
  689.      Entry ONE is where all AOS system calls are vectored.   This 
  690. location  is exactly 1024 bytes from the beginning of  AOS.   You 
  691. may  enter  Entry  ONE via Motorola interrupt TRAP  #1.   In  our 
  692. example  code we've vectored TRAP #1 to point to this  location*.  
  693. Please notice the general format for Entry ONE system calls:
  694.  
  695.      MOVE.L    #MAIL_BOX,A0
  696.      MOVE.L    POSTBX,D0
  697.      TRAP      #1
  698.  
  699.  
  700. 1.2.2    Entry  TWO
  701.  
  702.      Entry TWO is the simple dispatcher.  This location is exact-
  703. ly  2048 bytes from the beginning of AOS.   Entry TWO is  entered 
  704. via some interrupt.   In some of our example application code  we 
  705. used  TRAP  #0 to point to this location in order  to  reschedule 
  706. tasks.   When  we  wanted  to release the  processor,  we  simply 
  707. executed  a  TRAP #0 instruction which caused a  rescheduling  of 
  708. active tasks on a round-robin basis.  If you have a simple square 
  709. wave  pulsing into a 68000 hardware interrupt at 500  microsecond 
  710. intervals,  for  example,  you can "time-slice" by pointing  this 
  711. interrupt  vector  to Entry TWO.   Your dispatch  timer  must  be 
  712. automatic.   There  is no provision in Entry TWO for reloading  a 
  713. time-slice timer.  There is no provision in Entry TWO for execut-
  714. ing  any  special user code in the middle of the  dispatch.   For 
  715. high-speed applications, use Entry TWO for fast, simple dispatch-
  716. ing.  Use Entry THREE for special dispatch service.
  717.  
  718.  
  719.  
  720.  
  721. Copyright (C) 1986, 1987 by Creative Software Technology      1-8
  722.  
  723.  
  724.  
  725.  
  726.  
  727. Advance Operating System                                Chapter 1
  728.  
  729.  
  730.  
  731. 1.2.3    Entry  THREE
  732.  
  733.      Entry  THREE  is  located exactly 3072 (3K) bytes  from  the 
  734. beginning of AOS,  is essentially the same as Entry TWO with  one 
  735. important exception.   If the user supplies a non-zero address in 
  736. the  auxiliary dispatch vector (see configuration table parameter 
  737. "AUXDSP")  AOS will hop off to the location pointed to by  AUXDSP 
  738. right  in the middle of the dispatcher.   This concept allows  an 
  739. application to restart some dispatch interrupt timer right in the 
  740. middle of the dispatch service.  The user-supplied AUXDSP routine 
  741. can change any register but A7.   The system stack  pointer,  A7, 
  742. must be preserved by the user-supplied AUXDSP routine.   Obvious-
  743. ly, Entry THREE dispatch service is not going to be quite as fast 
  744. as  our simple,  Entry TWO dispatch because of the AUXDSP proces-
  745. sing.   Choose either Entry TWO or Entry THREE for your reschedu-
  746. ling of tasks, whichever one that best suits your application.
  747.  
  748.  
  749. 1.3  Interrupts
  750.  
  751.      AOS/68K,  from version 1.04 and on,  saves individual system 
  752. stack  pointers  on each user stack.   This change  was  made  to 
  753. handle multi-level,  nested interrupts from within task exception 
  754. processing.   Versions  before  1.04 kept the same  system  stack 
  755. pointer for all tasks.  The previously undefined DATAPTR must now 
  756. point  to how much system stack space is required per task.   See 
  757. the parameter "DATAPTR" in chapter 1 of this manual for details.
  758.  
  759.      The  AOS/68K 4K kernel MAKES NO TRAP CALLS whatsoever.   You 
  760. may use whatever trap vectors you have available to point to  the 
  761. AOS/68K entry vectors listed above.   If your 68000-based machine 
  762. already has trap 0,  1,  and 2 in use, no problem, use trap 3, 4, 
  763. and 5, or whatever trap vectors you have available.  AOS/68K does 
  764. not have to be modified.
  765.  
  766.      The AOS/IDM, however, uses specific traps (trap #0, trap #1, 
  767. and  trap  #2) to hook into the ADVANCE OPERATING SYSTEM  kernel.   
  768. The IDM,  with the exception of the Trap calls,  is position  and 
  769. device  independent.   For  a  limited  time,  Creative  Software 
  770. Technology  will  ship the IDM source code to companies that  pay 
  771. IDM's  list price.   You may change the trap numbers to  whatever 
  772. trap  numbers  your  system  needs.   For  those  companies  that 
  773. register AOS/IDM with CST,  CST will do the change for you at  no 
  774. additional cost.
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787. Copyright (C) 1986, 1987 by Creative Software Technology      1-9
  788.  
  789.  
  790.  
  791.  
  792.  
  793. Advance Operating System                                Chapter 1
  794.  
  795.  
  796.  
  797. 1.4  CONFIGURATION TABLE
  798.  
  799.  
  800.      The  ADVANCE  OPERATING SYSTEM is position  independent  and 
  801. occupies  a  4K ROM space in the target  microcomputer's  memory, 
  802. just in front of a user-supplied configuration table.  Figure 1-1 
  803. shows the basic structure of the configuration table.   The table 
  804. is composed of two major parts.  The first part is the configura-
  805. tion  table  "header."  The second part consists of from  one  to 
  806. ten-thousand  static  task control block "cells."  An  individual 
  807. static  task control block cell is composed of seven pieces (  28 
  808. bytes ) of information.
  809.  
  810.      As  soon as your system software architect decides upon  the 
  811. maximum number of tasks that will be needed,  populate a cell for 
  812. each task that is to be registered with ADVANCE.  These cells are 
  813. used by ADVANCE to form the various high-speed system data struc-
  814. tures, including stack space for each task.  Only in rare circum-
  815. stances  should  an application ever need to register  more  than 
  816. five  to  ten task cells.   It is nice  to  know,  however,  that 
  817. ADVANCE  can manage more tasks than most applications  will  ever 
  818. need.
  819.  
  820.                                              
  821.  
  822.                                              
  823.                                              
  824.                        --------------------- 
  825.                $XX00  |       HEADER        |
  826.                        ===================== 
  827.                $XX20  |       TASK 1        |
  828.                       |---------------------|
  829.                $XX3C  |       TASK 2        |
  830.                       |---------------------|
  831.                $XX58  |       TASK 3        |
  832.                       |---------------------|
  833.                $XX74  |       TASK 4        |
  834.                       |---------------------|
  835.                $XX90  |       TASK 5        |
  836.                       .                     .
  837.                       .                     .
  838.                       .                     .
  839.                       |---------------------|
  840.                       |       TASK N        |
  841.                        --------------------- 
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.                  Figure 1-2  Configuration Table
  849.  
  850.  
  851.  
  852.  
  853. Copyright (C) 1986, 1987 by Creative Software Technology      1-10
  854.  
  855.  
  856.  
  857.  
  858.  
  859. Advance Operating System                                Chapter 1
  860.  
  861.  
  862. 1.4.1  Configuration Table Parameters
  863.  
  864.  
  865.      The  ADVANCE OPERATING SYSTEM uses both stack structures and 
  866. non-stack  structures.   Whenever AOS uses stack  structures  the 
  867. user manual will identify them as such.   Stack structures,  such 
  868. as the AOS mailbox structure,  are put into memory backwards from 
  869. the  way  the  static configuration table  organizes  parameters.     
  870. The configuration table parameters discussed below, are placed in 
  871. memory  in  numerical order.   If parameter VALID is  located  at 
  872. $B000,  then  RAMPTR  will be located at $B004,  RAMSIZE will  be 
  873. located at $B008, etc.
  874.  
  875.  
  876.  
  877.                                              
  878.                                              
  879.                                              
  880.                                              
  881.                        --------------------- 
  882.                $XX00  |  V    L    I    D   |
  883.                       |---------------------|
  884.                $XX04  |      RAMPTR         |
  885.                       |---------------------|
  886.                $XX08  |      RAMSIZE        |
  887.                       |---------------------|
  888.                $XX0C  |      AUXRST         |
  889.                       |---------------------|
  890.                $XX10  |      AUXDSP         |
  891.                       |---------------------|
  892.                $XX14  |      SERVPTR        |
  893.                       |---------------------|
  894.                $XX18  |      DATAPTR        |
  895.                       |---------------------|
  896.                $XX1C  |      NTASKS         |
  897.                        --------------------- 
  898.  
  899.  
  900.  
  901.  
  902.  
  903.  
  904.  
  905.              Figure 1-3  Configuration Table Header
  906.  
  907. _________________________________________________________________
  908.  
  909.  
  910. -SPECIAL NOTES -- The letters "T.B.D." stand for "to be  defined," 
  911. meaning  that  the  parameter  associated with  "T.B.D."  is  not 
  912. defined in this release of the user manual.  We are expanding the 
  913. functionality  of the ADVANCE OPERATING SYSTEM and have  included 
  914. certain  pointers for upward compatibility with future releases. 
  915.  
  916.  
  917.  
  918.  
  919. Copyright (C) 1986, 1987 by Creative Software Technology      1-11
  920.  
  921.  
  922.  
  923.  
  924.  
  925. Advance Operating System                                Chapter 1
  926.  
  927.  
  928.  
  929. struct TOP
  930.  
  931.      This  structure is the configuration table.   AOS  needs  to 
  932. know certain things about the application code.   This structure, 
  933. placed just behind AOS in the 68000 memory map, is the vital link 
  934. between  AOS  and  the application program.   If AOS were  to  be 
  935. placed at $A000, for instance, then this structure needs to be at 
  936. $B000.   The  ADVANCE OPERATING SYSTEM is  position  independent.  
  937. AOS  will  work  correctly placed almost anywhere  in  the  68000 
  938. address space.  Naturally, of course, AOS cannot run correctly if 
  939. it is placed over top of the exception vector table.  
  940.  
  941.  
  942. VALID   BYTE    'VLID'
  943.  
  944.      AOS  examines this location in order to see if a valid  user 
  945. program is in memory.   If the  ASCII capital letters "VLID"  are 
  946. the  first  4 bytes in the configuration table,  then AOS  "turns 
  947. on."   If  VLID is not at this location then the  program  halts.  
  948. This feature is used primarily during ram debugging.   If for any 
  949. reason an application "leaves" a ram environment (power interrup-
  950. tion,  etc.),  AOS  tries  to detect it and will not jump  to  an 
  951. invalid application if the "VLID" signature is not present.
  952.  
  953.  
  954. RAMPTR  LONG    $2000
  955.  
  956.      This points to application RAM.  AOS uses this RAM for stack 
  957. files,  task stacks,  tables,  lists, data structures, and system 
  958. variables.   In  our  assembly  language example we  are  telling 
  959. ADVANCE that there is ram available starting at location $2000.
  960.  
  961.  
  962. RAMSIZE LONG    $2500
  963.  
  964.      This  is the amount of application RAM that is available  at 
  965. location RAMPTR.  The formula for determining how much ram to set 
  966. aside for AOS is: 48 * number of tasks plus $100 bytes plus total 
  967. requested  stack  size = required RAM.   In our  example  we  are 
  968. telling  ADVANCE  that  there  is $2500 bytes  of  ram  available 
  969. starting at location RAMPTR.
  970.  
  971.  
  972. AUXRST  LONG    $0000
  973.  
  974.      This is the auxiliary reset routine.  Just after AOS sets up 
  975. the  system stack pointer,  the AUXRST vector  is  examined.   If 
  976. AUXRST is a non-zero value then AOS jumps to subroutine AUXRST in 
  977. order to execute user reset code.   In our example we are telling 
  978. ADVANCE  (by the presence of the $0000 at vector AUXRST) that  we 
  979. do not have any other special reset code that has to be executed.
  980.  
  981.  
  982.  
  983.  
  984.  
  985. Copyright (C) 1986, 1987 by Creative Software Technology      1-12
  986.  
  987.  
  988.  
  989.  
  990.  
  991. Advance Operating System                                Chapter 1
  992.  
  993.  
  994. AUXDSP  LONG    $0000
  995.  
  996.      This is the auxiliary dispatch routine.   If the application 
  997. uses Entry THREE dispatch code in order to reschedule tasks, then 
  998. AOS dispatch code examines this location.   If AOS detects a non-
  999. zero value at this location,  then AOS jumps to subroutine AUXDSP 
  1000. in  the  middle  of the normal dispatch service before  the  next 
  1001. active  task  is scheduled.   Address register A3 points  to  the 
  1002. address of the configuration table and address register A4 points 
  1003. to the beginning of system ram before the call to AUXDSP is made.  
  1004. The  user-supplied AUXDSP routine does not have to save A3 or  A4 
  1005. but  must  return from subroutine in the system state  (the  same 
  1006. state in which the processor was in prior to the AUXDSP call).
  1007.  
  1008.      In  our example we are telling ADVANCE (by the  presence  of 
  1009. the $0000 at vector AUXDSP) that we do not have any other special 
  1010. dispatch  code  that  has  to be  executed  during  the  dispatch 
  1011. service.   If  you  are  vectoring your dispatch service  to  the 
  1012. simple  dispatch version at Entry TWO then ADVANCE does not  even 
  1013. check vector AUXDSP (auxiliary dispatch service is not  available 
  1014. with the Entry TWO dispatch service). 
  1015.  
  1016.  
  1017. SERVPTR LONG    $0000
  1018.  
  1019.      This is a pointer to         ----------          ---------- 
  1020. the  optional  user  sup-  $XX00 | V L I D  |    --> | IN CHR1  |
  1021. plied   routines.     The        |----------|   |    |----------| 
  1022. ADVANCE  OPERATING SYSTEM  $XX04 |  RAMPTR  |   |    | OUT CHR1 | 
  1023. looks at the SERVPTR vec-        |----------|   |    |----------|
  1024. tor   itself  before   it        | RAMSIZE  |   |    | KYSTAT1  | 
  1025. examines  the  table   of        |----------|   |    |----------| 
  1026. pointers   that   SERVPTR        |  AUXRST  |   |    | TRNSTAT1 | 
  1027. points   to.     If   the        |----------|   |    |----------| 
  1028. SERVPTR  vector is  equal        |  AUXDSP  |   |    | IN CHR2  | 
  1029. to  a  $00000000 then  no        |----------|   |    |----------| 
  1030. further   processing   is  $XX14 | SERVPTR  | --     | OUT CHR2 | 
  1031. performed  for any  calls        |----------|        |----------| 
  1032. to  the  following   rou-        | DATAPTR  |        | KYSTAT2  |
  1033. tines.   The  ADVANCE OP-        |----------|        |----------|
  1034. ERATING   SYSTEM   kernel  $XX1C |  NTASKS  |        | TRNSTAT2 | 
  1035. (part one,  not the  IDM)        |----------|        |----------| 
  1036. does  not use any of  the  $XX20 |  TCB #1  |        | USR VEC1 | 
  1037. service  routines  unless        |----------|        |----------| 
  1038. the user-written applica-  $XX3C |  TCB #2  |        | USR VEC2 |
  1039. tion  makes  a call to  a        |----------|        |----------| 
  1040. user   supplied   vector.             :              | USR VEC3 |  
  1041. AOS will recognize the 16        |----------|             :       
  1042. routines   that   SERVPTR        |  TCB #N  |             :       
  1043. points to if the  vectors         ----------         |----------| 
  1044. do  not  contain  address                            | USR VEC8 | 
  1045. $000000.                                              ---------- 
  1046.  
  1047.                            Figure 1-4  User-Supplied Routines
  1048.  
  1049.  
  1050.  
  1051. Copyright (C) 1986, 1987 by Creative Software Technology      1-13
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057. Advance Operating System                                Chapter 1
  1058.  
  1059.  
  1060.      The  first eight vectors are reserved for AOS  user-supplied 
  1061. IDM  support  calls.   The second eight vectors are reserved  for 
  1062. additional  user-supplied routines.   The Interactive  Diagnostic 
  1063. Module  (IDM) uses the first four vectors to operate most of  the 
  1064. IDM commands.   One IDM command,  though,  called LINK,  needs to 
  1065. link  together  a user-supplied port number 1 to a  second  user-
  1066. supplied  port  number 2.   All other IDM commands use  only  the 
  1067. following  first  four vectors.   The first  eight  vectors  that 
  1068. SERVPTR points to are as follows:
  1069.  
  1070. 1)   in_character_p1  routine:   The IDM (Interactive  Diagnostic 
  1071. Module)  will jump to subroutine in_character_p1 to get data  and 
  1072. diagnostic  commands.   Subroutine in_character_p1 preserves  all 
  1073. registers  except  D0.   Upon return from  subroutine  in-charac-
  1074. ter_p1,  register  A0 points to a long word where the  low  order 
  1075. byte  contains a single ASCII piece of information from the  sup-
  1076. ported serial device.   IDM makes a call to key_status1 before it 
  1077. makes a call to in_character_p1 so as to permit task-sharing.
  1078.  
  1079. 2)  out_character_p1:   The IDM will jump to subroutine out_char-
  1080. acter_p1  to output data to some user supplied output device such 
  1081. as  a dumb terminal or another computer.   Vector 2  (out_charac-
  1082. ter_p1) preserves all registers.   The low order byte in D1  will 
  1083. contain  the  single  ASCII piece of information that  is  to  be 
  1084. output  to  the  user's  output device.   IDM  makes  a  call  to 
  1085. trn_status1  before it makes a call to out_character_p1 so as  to 
  1086. permit task-sharing.
  1087.  
  1088. 3)  key_status1:   The IDM needs to know if it is O.K.  to make a 
  1089. call to in_character_p1.  By definition the user-written in_char-
  1090. acter_p1  hogs  the processor until the character to be  sent  is 
  1091. actually  sent.   To  help prevent any task from hogging the  i/o 
  1092. device,  user-written  "key_status1"  routine can be  invoked  to 
  1093. return the status of the output default i/o device, before a call 
  1094. to  get_character_p1 is actually made.   User-written  code  pre-
  1095. serves  at  least  registers  A6 and  A7.   Whenever  a  call  to 
  1096. key_status1  is made,  the AOS/68K kernel will be returned one of 
  1097. the following two conditions:
  1098.  
  1099.      (1) C = 0:   If the carry bit in the condition code register 
  1100. is  set to 0 then there is no character ready to be  received  by 
  1101. making a call to "in_character_p1".  (2) C = 1:  If the carry bit 
  1102. in the condition code register is set to 1 then there is at least 
  1103. one  character ready to be received by making a call to "in_char-
  1104. acter_p1".
  1105.  
  1106. 4)   trn_status1:   This routine returns the status of the output 
  1107. device.  User-written trn_status1 examines the status register in 
  1108. the  output  device to see if the output port on  the  USART  (or 
  1109. whatever  device is currently being used) is ready to transmit  a 
  1110. character.   After  a  call to key_status1 the AOS kernel is  re-
  1111. turned  the C bit in the condition code in one of  the  following 
  1112. two states:
  1113.  
  1114.  
  1115.  
  1116.  
  1117. Copyright (C) 1986, 1987 by Creative Software Technology      1-14
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123. Advance Operating System                                Chapter 1
  1124.  
  1125.  
  1126.      (1) C = 0:   If the carry bit in the condition code register 
  1127. is  set to 0 then the output device is not ready to send a  char-
  1128. acter.   (2)  C  =  1:   If the carry bit in the  condition  code 
  1129. register is set to 1 then it is O.K.  to make a call to put_char.  
  1130. If a call to out_character_p1 is made without first making a call 
  1131. to key_stat1, then the other tasks cannot task-share the CPU.
  1132.  
  1133. 5)  in_character_p2: (same as above but use port #2, etc)
  1134. 6)  out_character_p2: (same as above but use port #2, etc)
  1135. 7)  key_status2: (same as above but use port #2, etc)
  1136. 8)  trn_status2: (same as above but use port #2, etc)
  1137.  
  1138.      If your system will require AOS/IDM, and you must have task-
  1139. sharing during character i/o, use the following table to make the 
  1140. necessary calls.
  1141.  
  1142.           To Call:                      Call This First:
  1143.  
  1144.        get_character_p1                 key_status1
  1145.        put_character_p1                 trn_status1
  1146.  
  1147. Note:   The  ADVANCE OPERATING SYSTEM kernel does not need to use 
  1148. any  of the user-supplied routines unless external  (application) 
  1149. software makes a call to one of the user-supplied  routines.   If 
  1150. you  have some other debugging methodology that does not  require 
  1151. the AOS/IDM,  then the AOS/68K kernel runs fine without the user-
  1152. supplied, default i/o device routines.  The IDM, at the time this 
  1153. manual  went  to press,  uses only  in_character_p1,  out_charac-
  1154. ter_p1, key_status1, and trn_status1.  None of the other routines 
  1155. described in the SERVPTR section are being used by the IDM.   The 
  1156. IDM  will make use of the rest of the user-supplied  routines  in 
  1157. future  versions of the IDM.   Therefore,  please supply at least 
  1158. the  first four routines if you are planning to use the  Interac-
  1159. tive  Diagnostic Module.   Please see the code at the end of  the 
  1160. user  manual for examples on how to set up and use the first four 
  1161. user-supplied routines.
  1162.  
  1163.  
  1164. DATAPTR LONG    $0000
  1165.  
  1166.      This  is a pointer to a user supplied table  of  parameters.  
  1167. The  first  (and  for now,  only) parameter is a long  word  that 
  1168. contains  the  size of the system stack for  each  task.  SS_SIZE
  1169. parameter can be any value between 256 and 4096 ($100 and $1000).  
  1170. If  the  system designer forgets to set up this pointer  and  its 
  1171. associated  stack value properly (not recommended),  AOS/68K  may 
  1172. allocate 256 bytes of system stack for each task.  If the DATAPTR 
  1173. itself is a 0,  then the system stacks for each task will default 
  1174. to 256 bytes of stack.   If SS_SIZE is a value greater that 4096, 
  1175. then  AOS/68K  will use 256 as the size of the system  stack  for 
  1176. each task.  Please reserve 256 bytes of system stack per task for 
  1177. AOS/68K.   If your system needs system stack for it's application 
  1178. exceptions,  then  add the extra stack space to the $100 bytes of 
  1179. system stack that AOS/68K needs.
  1180.  
  1181.  
  1182.  
  1183. Copyright (C) 1986, 1987 by Creative Software Technology      1-15
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189. Advance Operating System                                Chapter 1
  1190.  
  1191.  
  1192.      AOS/68K  keeps separate system stacks (as well  as  separate 
  1193. user  stacks)  for each task.   System stacks are kept  together, 
  1194. separate from user stacks.   All system stack sizes for each task 
  1195. will  be the same.   There is no way to define different sizes of 
  1196. system  stack space for different tasks.   If DATAPTR points to a 
  1197. long word that contains $500,  for example,  then each task  will 
  1198. get $500 bytes of system stack.
  1199.  
  1200.      To  set  up the system stacks,  initialize the system  stack 
  1201. pointer  to point to where you want the system stack area to  be.  
  1202. Then  jump  to  the beginning of  AOS/68K  (initially  enter  the 
  1203. AOS/68K  kernel  in the supervisor  mode).   Let's  suppose,  for 
  1204. example,  that  you entered AOS/68K with the system stack pointer 
  1205. equal  to $1100.   Say the system required $200 bytes  of  system 
  1206. stack for each of four tasks.  AOS/68K will use the ram area from 
  1207. $1100 to $1900 for system stacks,  and $100 bytes below $1100 for 
  1208. initial kernel stack usage*.  Task #1 will have it's system stack 
  1209. pointer set to $1300.  Task #2 will have it's system stack point-
  1210. er initialized to $1500,  task #3 stack pointer will be set up to 
  1211. $1700 and task #4 will have it's stack pointer set to $1900.
  1212.  
  1213.  
  1214. NTASKS  LONG    $0005
  1215.  
  1216.      This  is  the total number of tasks that the application  is 
  1217. wanting  to register.   Just because there is 5 in this  position 
  1218. does not mean that five tasks will become active.  The tasks that 
  1219. the  application  wants  to be made immediately  active  must  be 
  1220. defined in the static task control block (table) as being  ACTIVE 
  1221. in  order  to be placed in the active dispatch queue.   AOS  uses 
  1222. this  number  to  initially set up  all  data  blocks,  including 
  1223. stacks, at reset time.  AOS assumes that all registered tasks may 
  1224. become  active  at  the  same time and  provisions  are  made  to 
  1225. accommodate this situation.
  1226.  
  1227.  
  1228. NOTE:   At least one task must be active at all times in AOS/68K.  
  1229.         Systems  using  AOS/68K can never have  a  machine  state 
  1230.         where all tasks are inactive at the same moment in time.
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238. -----------------------------------------------------------------
  1239. *   (the  exact  system  stack size needed below  $1100  in  this 
  1240. example, depends on the several factors, one of which is how much 
  1241. stack  the AUXRST routine uses).   If you are not sure  how  much 
  1242. stack  below $1100 will be required,  and you are tight on  stack 
  1243. space,  initialize  $1000 to $1100 to a known value and do a  few 
  1244. resets.  Then examine the area from $1000 to $1100.
  1245.  
  1246.  
  1247.  
  1248.  
  1249. Copyright (C) 1986, 1987 by Creative Software Technology      1-16
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255. Advance Operating System                                Chapter 1
  1256.  
  1257.  
  1258. 1.5     STATIC TASK CONTROL BLOCK
  1259.  
  1260. struct TASK
  1261.  
  1262.      This is the static task control block.   Information in this 
  1263. structure  is used by AOS to set up various internal data struct-
  1264. ures.   If NTASKS is equal to five (5),  then there must be  five 
  1265. (5)  static task control blocks that are similar in form to  this 
  1266. one  for each task.   You can turn on the tasks at reset time  or 
  1267. dynamically  with the task_on system call.   You  must,  however, 
  1268. register  all possible tasks with AOS at system reset.   AOS sets 
  1269. up stacks for all registered tasks at reset time just in case all 
  1270. of  the tasks become active at the same time.   Tasks  that  have 
  1271. static  TCB  parameter  STATE set to ACTIVE (at RESET  time)  get 
  1272. placed in the active dispatch queue.  Tasks that have TCB parame-
  1273. ter STATE set to INACTV are not turned on at system reset.
  1274.                        _______________                 
  1275.                       |   |   |   |   |                
  1276.               $XX20   | STARTING ADR  | --> PCTR       
  1277.                       |___|___|___|___|_______________ 
  1278.                       |   |   |   |   |   |   |   |   |
  1279.               $XX24   | T | A | S | K | N | A | M | E |
  1280.                       |___|___|___|___|___|___|___|___|
  1281.                       |   |   |   |   |                
  1282.               $XX2C   | S T K S I Z E |                
  1283.                       |___|___|___|___|                
  1284.                       |   |   |   |   |                
  1285.               $XX30   | EDC TBLE PNTR |                
  1286.                       |___|___|___|___|                
  1287.                       |   |   |   |   |                
  1288.               $XX34   |  U S R P A R  |                
  1289.                       |___|___|___|___|                
  1290.                       |   |   |                        
  1291.               $XX38   | STATE |                        
  1292.                       |___|___|                        
  1293.                       |   |   |                        
  1294.               $XX3A   | TSKNO |                        
  1295.                       |___|___|               
  1296.  
  1297.                  Figure 1-3  Task Control Block
  1298.  
  1299. PCTR    LONG    #MOD1
  1300.  
  1301.      This  is the initial transfer vector for a registered  task.  
  1302. When  this task is next in the dispatch queue program control  is 
  1303. turned over to this location whenever a task is scheduled for the 
  1304. first time.
  1305.  
  1306. NAME    BYTE    'Mod XXXX'
  1307.  
  1308.      This is the 8-byte ASCII name of the task.  The name assists 
  1309. in  the  routine  debugging of a program  whenever  the  optional 
  1310. diagnostic   software  is  running  concurrent  with  the  user's 
  1311. application program.
  1312.  
  1313.  
  1314.  
  1315. Copyright (C) 1986, 1987 by Creative Software Technology      1-17
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321. Advance Operating System                                Chapter 1
  1322.  
  1323.  
  1324. STKSIZE LONG    $400
  1325.  
  1326.      This is the amount of stack that this task needs.  The limit 
  1327. to  the  amount of stack that a task can have is based  upon  the 
  1328. total  amount  of ram that this task,  and the other  tasks  will 
  1329. require.   The  application engineer needs to allow enough  stack 
  1330. space  for  each  task  to  execute  properly.   AOS,  for  speed 
  1331. purposes,  does  NO stack-checking.   Be sure to allow plenty  of 
  1332. stack  for  each task.   Later on,  when the  code  is  debugged, 
  1333. optimize the task stacks.  
  1334.  
  1335.  
  1336. EDCTBLE LONG    $0000
  1337.  
  1338.      This  is  a  pointer to this task's  Error  Recovery  table. 
  1339. Please  make  this vector equal to $000000 for the time being  in 
  1340. order to be upward compatible with future releases of  AOS.   The 
  1341. features  to be found in our optional ERI software will generally 
  1342. make  a  significant improvement in  the  speed,  efficiency  and 
  1343. reliability of the applications progam. 
  1344.  
  1345.  
  1346. USRPAR  LONG    $0000
  1347.  
  1348.      This is a pointer to user supplied parameters. (T.B.D.)
  1349.  
  1350.  
  1351. STATE   WORD    ACTIVE
  1352.  
  1353.      This  is a 2-byte flag that tells AOS if this task is to  be 
  1354. made active or not active.  If the value here is ACTIVE (any non-
  1355. zero value) then this task is placed in the active dispatch queue.
  1356.  
  1357.  
  1358. TASKNO  WORD    TASK
  1359.  
  1360.      This  is the "I.D." number of this task.   Any number from 1 
  1361. to 65,535 is considered by AOS to be a valid task  identification 
  1362. number.   Parameter  TASKNO does not relate to a task's  dispatch 
  1363. priority.  A large or small number in this location has no affect 
  1364. on  the relative importance of a task as far as AOS is concerned.  
  1365.  
  1366.      Although the user can initially order the dispatch sequence, 
  1367. ADVANCE  will very probably change the order of the  dispatch  as 
  1368. soon  as any one of several system calls are made.   For example, 
  1369. turning  off  and  on the same task will take  the  task  out  of 
  1370. wherever it was in the dispatch queue when the task is turned off 
  1371. and  place the task at the end of the dispatch queue whenever  it 
  1372. is turned back on again.  If this turning off and on again of the 
  1373. same  task  is  interspearsed with other system  calls  there  is 
  1374. always  the  remote possibililty that the task,  whenever  it  is 
  1375. turned back on again,  will find itself back in exactly the same, 
  1376. original dispatch position as it started out from.
  1377.  
  1378.  
  1379.  
  1380.  
  1381. Copyright (C) 1986, 1987 by Creative Software Technology      1-18
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387. Advance Operating System                                Chapter 1
  1388.  
  1389.  
  1390. 1.6     TASK PRIORITIES
  1391.  
  1392.      Please do not depend upon prioritization by task numbers  or 
  1393. a  certain  dispatch sequence in the design of  your  application 
  1394. code if you plan on using system calls such as "delay," "tsk_on," 
  1395. "tsk_off," etc.  Task numbers have nothing to do with task prior-
  1396. ities.  The ADVANCE OPERATING SYSTEM is designed to run sophisti-
  1397. cated  error recovery software which does not permit unequal task 
  1398. priorities.   Temporary task prioritization may be achieved, how-
  1399. ever, by letting "important" tasks make system calls which do not 
  1400. permit rescheduling of tasks.   Rescheduling of tasks from system 
  1401. calls  is  disabled by setting a certain bit true in  AOS  system 
  1402. command  words.   The ADVANCE OPERATING SYSTEM uses the  Balanced 
  1403. System Design where all tasks are assigned equal priorities  (see 
  1404. section  1.6).   Also,  please  make a note of the fact that  two 
  1405. special  task  numbers  are reserved  by  the  ADVANCE  OPERATING 
  1406. SYSTEM.  These two special reserved task numbers are:
  1407.  
  1408.      -1  ($FFFF):   This  number is put into a registered  task's 
  1409. mailbox  (  in  the "SENDER" parameter ) whenever it  receives  a 
  1410. message  from  some interrupt routine.   Interrupt  routines  are 
  1411. normally  not "tasks" and as such are not assigned task  numbers.  
  1412. Since an interrupt can send a message to any task,  however, a -1 
  1413. clearly  indicates the origin of the message in a task's  mailbox 
  1414. (see AOS system call post_box in chapter 2). 
  1415.  
  1416.      "ID":   The  ASCII characters "ID" ($4944) are reserved  for 
  1417. use  as  the task number of the Interractive  Diagnostic  Module.  
  1418. Please  do not use $4944 as a task number for any user-registered 
  1419. tasks.   If  you  are  going to be using the  IDM  for  debugging 
  1420. purposes,  please place the characters "ID" in the  corresponding 
  1421. task  number location in the configuration block associated  with 
  1422. the IDM transfer vector, etc.
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447. Copyright (C) 1986, 1987 by Creative Software Technology      1-19
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453. Advance Operating System                                Chapter 1
  1454.  
  1455.  
  1456. 1.7       TASK STATES
  1457.  
  1458.      The  ADVANCE OPERATING SYSTEM puts registered tasks into one 
  1459. of  three  states.   A registered task is a task  that  has  been 
  1460. defined  in  the Configuration table with a static  task  control 
  1461. block.   The  three states are INACTIVE,  ACTIVE,  and EXECUTING.  
  1462. The three states are as follows:
  1463.  
  1464.  
  1465.        INACTIVE <----------> ACTIVE <----------> EXECUTING
  1466.  
  1467.  
  1468.      INACTIVE:  An  inactive task is defined to be any registered 
  1469. task  that  is  not in the process queue  (sometimes  called  the 
  1470. dispatch  queue).   This task is said to be "off,"  or  inactive.  
  1471. The  stack associated with this inactive task is preserved for as 
  1472. long  as  power is applied to the  computer.   ADVANCE  does  not 
  1473. permit  permanently turning off a task so as to free up his stack 
  1474. space for other tasks.
  1475.  
  1476.      ACTIVE:    An  active task is defined to be  any  registered 
  1477. task  that is in the process queue (sometimes called the dispatch 
  1478. queue).   The  task is ready to be dispatched so as  to  continue 
  1479. from  wherever it was executing code before the last task switch.  
  1480. Tasks  currently scheduled to run in a process queue in a  multi-
  1481. tasking  operating system seem as if they are all active  at  the 
  1482. same time.   Technically speaking,  of course,  there is only one 
  1483. active  task  at  time in a single  microprocessor  design.   The 
  1484. system  gives  the impression that a group of tasks  are  active, 
  1485. while another group of tasks are inactive.  
  1486.  
  1487.      EXECUTING:   An  active  task that is  currently  using  the 
  1488. processor's program counter, internal registers, etc.
  1489.  
  1490.      System  call  tsk_on,  for instance,  puts a task  into  the 
  1491. dispatch  queue.   This  does not mean that the task just  turned 
  1492. "on" is going to be instantly placed in the EXECUTING state.   It 
  1493. is simply in an ACTIVE state,  ready to be placed in a  EXECUTING 
  1494. state.   System call tsk_off takes ACTIVE tasks (sometimes EXECU-
  1495. TING tasks) and puts them in the INACTIVE task state. For as long 
  1496. as  logic power is supplied to the microcomputer,  the stack area 
  1497. for the inactive task remains untouched by the operating  system.  
  1498. The  INACTIVE  task can be turned on again (placed in the  ACTIVE 
  1499. state) by making a call to tsk_on.   The task just activated gets 
  1500. his untouched stack space back again.
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513. Copyright (C) 1986, 1987 by Creative Software Technology      1-20
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519. Advance Operating System                                Chapter 1
  1520.  
  1521.  
  1522. 1.8  THE BALANCED SYSTEM DESIGN
  1523.  
  1524.      The  Advance  Operating  System is based upon  the  Balanced 
  1525. System Design concept.   In the Balanced System Design, each task 
  1526. in   a   multitasking  system  is  given  an  equal   amount   of 
  1527. functionality.   To  explain  the Balanced System  Design  it  is 
  1528. helpful  to  describe an unbalanced system design first.   In  an 
  1529. unbalanced  multitasking  system tasks are  assigned  an  unequal 
  1530. amount  of responsibility.   If an error occurs in a "top  heavy" 
  1531. task,  one  that has more than it's share of  functionality,  the 
  1532. whole  application suffers.   Resources may be unnecessarily tied 
  1533. up  by the errant task.   Small tasks with (a few functions  and) 
  1534. artificially  high priorities can also cause  resource  problems, 
  1535. especially  whenever  they  try to correct for  run-time  errors.  
  1536. Also,  since functions are not evenly distributed throughout  the 
  1537. system   architecture,   tasks  are  forced  to  arbitrarily  and 
  1538. artificially  change their priorities to make up for a  lop-sided 
  1539. design  topology.   Asynchronous errors are difficult to  correct 
  1540. for in such unevenly designed systems.
  1541.  
  1542.      What  is  a Balanced System?   In  a  balanced  multitasking 
  1543. system each task has an even amount of functionality.   Why use a 
  1544. Balanced  System?   Balanced Systems are generally more efficient 
  1545. than unbalanced systems because they share system resources  more 
  1546. evenly,  and  they  share the work load more evenly.   No  single 
  1547. task can tie up the whole system indefinately.  A Balanced System 
  1548. is also more fault tolerant.  Expert System inference engines can 
  1549. run  recovery  algorithms  with  the  assurance  that  they  will 
  1550. probably  be executed,  not locked out by a  instaneous  priority 
  1551. lock-out  problem.
  1552.  
  1553.      The  net  effect of balancing functions is that many  former 
  1554. "fatal"  errors are now not "fatal."  If a task discovers a  cor-
  1555. rectable run-time error in a Balanced System, the other tasks can 
  1556. usually run for a short amount of time.   This grace period gives 
  1557. the errant task,  by authority of a supervisory task which  moni-
  1558. tors the state of the system process,  enough time to correct the 
  1559. error.   By spreading the functionality evenly over several tasks 
  1560. you  can therefore avoid shutting down the system for many former 
  1561. "fatal"  errors  ( please refer to chapter four  for  a  detailed 
  1562. description of the Balanced System error recovery techniques).
  1563.  
  1564.      How do you design a Balanced System?  The steps necessary to 
  1565. design a Balanced System are:
  1566.  
  1567.      1)    Write  down  on  a large piece of  paper  all  of  the 
  1568. functions that the system is supposed to do.
  1569.  
  1570.      2)   On a second piece of paper in a time-line format, using 
  1571. the first piece of paper as a reference,  group all of the system 
  1572. functions  in such a way as to show the functions that can happen 
  1573. concurrently.   There  are rare situations where you will not  be 
  1574. able to spot any concurrent functions.   For our example,  assume 
  1575. we have a need for concurrency.
  1576.  
  1577.  
  1578.  
  1579. Copyright (C) 1986, 1987 by Creative Software Technology      1-21
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585. Advance Operating System                                Chapter 1
  1586.  
  1587.  
  1588.      3)    On  the  same piece of paper (or on a third  sheet  of 
  1589. paper) evenly distribute logically-related functions into a small 
  1590. number of tasks.  Be quite sure that all of the tasks assigned by 
  1591. this  process can really do work  concurrently.    Two  logically 
  1592. related,  serial  processes  can be grouped into the  same  task. 
  1593. Please  do not make two logically related,  serial processes into 
  1594. two tasks.    Use geographical partitions to assist you like data 
  1595. aquisition,  data processing,  data output,  etc.,  or, the front 
  1596. loader  section  of  the machine,  the  testing  section  of  the 
  1597. machine, the sorting section of the machine, etc.
  1598.  
  1599.      4)    Finally,  geographically or in some other logical way, 
  1600. assign  high priority asynchrounous events (hardware  interrupts) 
  1601. evenly  to  tasks  with related  functionality.   When  you  have 
  1602. finished your system design,  leave it for awhile.   Go get some-
  1603. thing to drink, relax, or whatever.  Later on, with a clear mind, 
  1604. review your design again.   Talk it over with someone  else.   If 
  1605. you  do not feel comfortable with your design,  rework it again a 
  1606. few times until your are sure that system functions are  distrib-
  1607. uted as evenly as possible among all of the tasks.
  1608.  
  1609.  
  1610.  
  1611.  
  1612.  
  1613.  
  1614.  
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645. Copyright (C) 1986, 1987 by Creative Software Technology      1-22
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655. 2.0  ADVANCE OPERATING SYSTEM CALLS (Part One)
  1656.  
  1657. 2.0.1     User Mode verses System Mode
  1658.  
  1659.         Special Entry Considerations For All System Calls:
  1660.  
  1661.      There  are two major entry conditions for AOS system  calls: 
  1662. entry from user mode and entry from system mode.  Some AOS system 
  1663. calls work for both conditions.  Please take time to read through 
  1664. the  system  command  specifications before you make  any  system 
  1665. calls.    As a general rule,  making a system call from user mode 
  1666. means that a round-robin rescheduling of tasks will occur  before 
  1667. a task returns to its code.   Making a system call from within an 
  1668. interrupt,  or from within system mode, however, will not cause a 
  1669. rescheduling  of  tasks  before the calling task returns  to  its 
  1670. code.
  1671.  
  1672.      Please make a note of the fact that AOS system calls support 
  1673. one or the other entry conditions:  entry from user mode or entry 
  1674. from  system  mode,  and in some cases,  entry from either  mode.  
  1675. This  design issue was addressed with the idea of supporting  the 
  1676. majority  of  practical  cases with  the  necessary  flexibility.  
  1677. Let's examine some common situations:
  1678.  
  1679.      You  can turn on or off any registered task from within  the 
  1680. user mode.  Suppose that one task monitors i/o events.  This same 
  1681. task,  from  the  user mode can turn on other  tasks  based  upon 
  1682. sensor  information.   You can also turn on a task from within an 
  1683. application  exception.   An interrupt occurs and  for  practical 
  1684. reasons, such as the presence of a string sentinel character, you 
  1685. want to turn on a task to process the newly entered string.   AOS 
  1686. system  call tsk_on recognizes that the caller was in the  system 
  1687. mode  and turns on the requested task and returns immediately  to 
  1688. the  instruction  just  past the call  to  tsk_on.   System  call 
  1689. tsk_on,  when  invoked  from  the system  mode,  does  not  force 
  1690. rescheduling  as  it  would have done if the call to  tsk_on  had 
  1691. originated from user mode.  
  1692.  
  1693.      AOS system call tsk_off,  however, must be entered only from 
  1694. the user mode, if it is expected to work correctly (this informa-
  1695. tion  is in the tsk_off specification).   For most cases,  a user 
  1696. will not want to turn off tasks from within an  exception.   Most 
  1697. of the time a task will get turned off while it is waiting for na 
  1698. event  or message from another task.   AOS supports turning off a 
  1699. task off in a few interesting ways.   System call "receive"  will 
  1700. turn  off the calling task until the task receives a message from 
  1701. some requested task as specified by the task's id number.   If  a 
  1702. management  task decides to terminate a task he can do this  also 
  1703. by  making a call to tsk_off from within the user  mode.   System 
  1704. call "delay" supports turning off a task also.  When a task wants 
  1705. to  delay  for a time,  it is turned off automatically until  the 
  1706. delay counter reaches zero.  The task is then turned on again.
  1707.  
  1708.  
  1709.  
  1710.  
  1711. Copyright (C) 1986, 1987 by Creative Software Technology      2-1
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717. Advance Operating System                                Chapter 2
  1718.  
  1719.  
  1720. 2.0.2     System Register Parameters
  1721.  
  1722.      ADVANCE  system  calls have other common  features.  When  a 
  1723. system command detects an error condition, address register A1 is 
  1724. used to point to a four byte register that returns status  infor-
  1725. mation  from  the system call.   The calling task's  A1  register 
  1726. itself  is returned to the caller unchanged.   If a task wants to 
  1727. turn on a task, it must do one of two things with register A1:
  1728.  
  1729.      1)   Set  address register A1 equal  zero  (0).   After  the 
  1730. caller  returns  to  his code (from making a system  call)  he'll 
  1731. notice that A1 and the data A1 points to are not changed.   If  a 
  1732. task does not care if an error occurs, then set A1 to equal zero.
  1733.  
  1734.      2)   Point  A1 to some status long word other  than  address 
  1735. location zero.   If a system command defines certain errors  that 
  1736. can  occur,  then  just after a caller returns to his code  (from 
  1737. making  a  system call) the long word that A1 points to  will  be 
  1738. written  to  with either a pre-defined error code  or  $00.   The 
  1739. error  code  is a number less than $80.  The long  word  that  A1 
  1740. points to will be set equal to zero whenever no errors are detec-
  1741. ted in the execution of the system command.   Address register A1 
  1742. is not changed.  Make a habit of always initializing A1 properly.
  1743.  
  1744.      Please   remember  set  up  A1  to  one  of  the  above  two 
  1745. conditions.    Please take the time to check each command for the 
  1746. correct use of register A1.   Most system calls require that data 
  1747. register D0 be set up to equal the requested system command code.  
  1748. The AOS commands are each a long word in length.   The  essential 
  1749. command information, however, is frequently within bits 0 through 
  1750. 7 of the least significant byte of the least significant word:
  1751.  
  1752.                  D0_CODE              COMMAND
  1753.  
  1754.                 $00000001              tsk_on
  1755.                 $00000042              tsk_off
  1756.                 $00000003              tsk_stat
  1757.                 $00000044              tsk_id
  1758.                 $00000048              post_box
  1759.                 $00000009              send
  1760.                 $0000004A              receive
  1761.                 $0000000B              sendx
  1762.                 $00000010              time_set
  1763.                 $00000011              time_read
  1764.                 $00000012              tick
  1765.                 $00000053              delay
  1766.                 $00000018              put_char
  1767.                 $00000019              get_char
  1768.                 $0000001A              key_stat
  1769.                 $0000001B              trn_stat
  1770.                 $00000020              gt_cpt
  1771.                 $000000A1              g_stk
  1772.                 $00000022              res_tsk
  1773.  
  1774.  
  1775.  
  1776.  
  1777. Copyright (C) 1986, 1987 by Creative Software Technology      2-2
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783. Advance Operating System                                Chapter 2
  1784.  
  1785.  
  1786.      Bit  7  of the command word has  special  significance.   By 
  1787. setting  bit  7 true on the following AOS/68K commands ( set  bit 
  1788. seven  =  1  ),  you have another list of AOS  commands  that  do 
  1789. essentially  the  same thing as the  original,  similar  commands 
  1790. without bit 7 set true.  Setting bit 7 = 1 is designed to let the 
  1791. calling  task  return to his code,  just past the trap  #1  call, 
  1792. without  causing  a re-scheduling of  tasks.   This  function  is 
  1793. useful for a lot of reasons.   One such reason would be to see if 
  1794. another task is active at a particular moment in time.
  1795.  
  1796.      Setting  bit  7  true on  some  commands,  however,  is  not 
  1797. recommended.   Tasks making calls such as "receive" for instance, 
  1798. would  not  want  to return back to their code until they  get  a 
  1799. message from the calling task.   The illegal "rq_" (return quick) 
  1800. version  of  AOS/68K command "receive" would  give  unpredictable 
  1801. results.   AOS/68K special Return Quick commands, prefixed with a 
  1802. "rq_", are as follows:
  1803.  
  1804.                  D0_CODE              COMMAND
  1805.  
  1806.                 $00000081            rq_tsk_on
  1807.                 $00000083            rq_tsk_stat
  1808.                 $000000C4            rq_tsk_id
  1809.                 $000000C8            rq_post_box
  1810.                 $00000089            rq_send
  1811.                 $00000090            rq_time_set
  1812.                 $00000091            rq_time_read
  1813.                 $00000092            rq_tick
  1814.                 $00000098            rq_put_char
  1815.                 $00000099            rq_get_char
  1816.                 $000000A2            rq_res_tsk
  1817.  
  1818.  
  1819. Other registers may have to be set up prior to making each system 
  1820. call.   Check  the  command description for the command  you  are 
  1821. intending  to  use for information on register  parameter  usage.  
  1822. Many of the program examples in this manual use position indepen-
  1823. dent,  stacked  parameters.   Appendix B shows many assembly lan-
  1824. guage,  position independent, parameter examples.  Using position 
  1825. independent code is not required, however.
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843. Copyright (C) 1986, 1987 by Creative Software Technology      2-3
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849. Advance Operating System                                Chapter 2
  1850.  
  1851.  
  1852. 2.1  AOS System Command Specifications
  1853.  
  1854.      PLEASE NOTE:   The following system commands in chapters two 
  1855. and  three show how to use the system calls from "C," for  formal 
  1856. parameter clarification purposes only.  For example:
  1857.  
  1858. TYPICAL USAGE:  tsk_on ( motors, &status );  
  1859.  
  1860. We  are not including an interface library with the base  section 
  1861. one.  If we have an interface library available for your compiler 
  1862. we  will  make it available to you at a small additional  charge.  
  1863. Please  use  the code examples in the  "ASSEMBLY  INTERFACE"  for 
  1864. designing assembly language programs.  Example:
  1865.       
  1866. NAME:     tsk_switch
  1867.   
  1868. DESCRIPTION:
  1869.  
  1870.      Tsk_switch  is the programmer's way to release the processor 
  1871. voluntarily.   Tsk_switch causes a rescheduling of the next  task 
  1872. in  the dispatch queue.   The current task's environment is saved 
  1873. on  the  current user stack while the next task in  the  dispatch 
  1874. queue is dispatched.   If the regular timer interrupt dispatch is 
  1875. sometimes  not quite often enough for certain  applications,  use 
  1876. tsk_switch to reschedule processes more rapidly.   Tsk_switch  is 
  1877. also  used in many system designs to replace the need for a regu-
  1878. lar timer interrupt type of forced rescheduling.  Whenever "time-
  1879. slicing" is not used,  tsk_switch is placed in the inside loop of 
  1880. all program loops that would "hog" the processor for longer than, 
  1881. say, 200 microseconds.
  1882.  
  1883. ENTRY CONDITIONS:  User Mode only.
  1884.  
  1885. TYPICAL USAGE:    tsk_switch();
  1886.  
  1887. ASSEMBLY INTERFACE: TRAP #0
  1888.  
  1889. PARAMETERS:         None.
  1890.  
  1891. REGISTERS CHANGED:  None.
  1892.  
  1893. CAVEATS:
  1894.  
  1895.      AOS/68K  tasks  that service exceptions,  upon entering  the 
  1896. supervisor  state,  must lock out interrupts  as their first  in-
  1897. struction.   A time-slice timer must not be allowed to initiate a 
  1898. round-robin rescheduling of tasks while one task is in the super-
  1899. visor state.  Why?   The AOS/68K task switch routines do not save 
  1900. the supervisor stack pointer on the user stack.  If a task switch 
  1901. is allowed while one task is in the supervisor  state,  important 
  1902. data (like return addresses) can be lost on the supervisor stack.
  1903.  
  1904. RETURN VALUES:      None.
  1905.  
  1906.  
  1907.  
  1908.  
  1909. Copyright (C) 1986, 1987 by Creative Software Technology      2-4
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915. Advance Operating System                                Chapter 2
  1916.  
  1917.  
  1918. NAME:  tsk_on
  1919.  
  1920. DESCRIPTION:
  1921.  
  1922.      Use  tsk_on to turn on any registered  inactive  task.   The 
  1923. calling task sets up three parameters:  1) the i.d. number of the 
  1924. task he wants to turn on, 2) the address of a status word, and 3) 
  1925. the command word.
  1926.  
  1927. ENTRY CONDITIONS:  User Mode or System Mode.
  1928.  
  1929. TYPICAL USAGE:    tsk_on  ( motors, &status );
  1930.  
  1931. ASSEMBLY INTERFACE:
  1932.  
  1933.           LINK      A6,#-PARAMETER_TABLE     
  1934.           LEA.L     -STATUS(A6),A1
  1935.           MOVE.L    #TSK_ON,D0
  1936.           MOVE.L    #TASK4,D1
  1937.           TRAP      #1
  1938.           TST.L     (A1)
  1939.           BEQ.S     NO_ERROR
  1940.           BSR       ERROR_MSG      A1 POINTS TO USEFUL ERROR DATA;
  1941. NO_ERROR  EQU       $
  1942.  
  1943. PARAMETERS:
  1944.  
  1945.      D0 = command long word;  D1 = target task;  and A1 = pointer 
  1946. to status long word.
  1947.  
  1948. REGISTERS CHANGED:  None.
  1949.  
  1950. CAVEATS:
  1951.  
  1952.      The  newly  activated task is added to the "bottom"  of  the 
  1953. present dispatch queue.   The caller cannot place the newly acti-
  1954. vated task "next" in the dispatch.
  1955.  
  1956. RETURN VALUES:
  1957.  
  1958.      Parameter  STATUS is reset to $00000000 if call to tsk_on is 
  1959. successful.   Otherwise  STATUS  is set to one of  the  following 
  1960. error conditions, right justified within the long word:
  1961.  
  1962.      $01 : The task you tried to turn on is already on.
  1963.      $02 : There is no inactive task with that i.d. number.
  1964.      $03 : There are no active or inactive tasks*.
  1965.      $04 : There are no inactive tasks at the moment.
  1966.  
  1967.  
  1968. *Although  normally impossible,  a system RAM problem could cause 
  1969.  this rare error condition.
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975. Copyright (C) 1986, 1987 by Creative Software Technology      2-5
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981. Advance Operating System                                Chapter 2
  1982.  
  1983.  
  1984. NAME:  tsk_off  
  1985.  
  1986. DESCRIPTION:
  1987.  
  1988.      Use tsk_off to turn off any active task,  including the task 
  1989. that makes the call.  The calling task just sets up three parame-
  1990. ters: 1) the i.d. number of the task he wants to turn off, 2) the 
  1991. address  of  a status word,  and 3) the command  word.   If  this 
  1992. command is entered from the system mode,  which is not permitted, 
  1993. the  target  task is not turned off and a rescheduling  of  tasks 
  1994. does not occur.
  1995.  
  1996. ENTRY CONDITIONS:  User Mode only.
  1997.  
  1998. TYPICAL USAGE:    tsk_off ( solenoids, &status );
  1999.  
  2000. ASSEMBLY INTERFACE:
  2001.  
  2002.           LINK      A6,#-PARAMETER_TABLE
  2003.           LEA.L     -STATUS(A6),A1
  2004.           MOVE.L    #TSK_OFF,D0
  2005.           MOVE.L    #TASK4,D1
  2006.           TRAP      #1
  2007.           TST.L     (A1)
  2008.           BEQ.S     NO_ERROR
  2009.           BSR       ERROR_MSG      A1 POINTS TO USEFUL ERROR DATA;
  2010. NO_ERROR  EQU       $
  2011.  
  2012. PARAMETERS:
  2013.  
  2014.      D0 = command long word;  D1 = target task;  and A1 = pointer 
  2015. to status long word.
  2016.  
  2017. REGISTERS CHANGED:  None.
  2018.  
  2019. CAVEATS:
  2020.  
  2021.      The task you just turned off looses his relative position in 
  2022. the dispatch queue.  Even if it is turned back on again, it might 
  2023. not  be  dispatched in its original dispatch  sequence.
  2024.  
  2025. RETURN VALUES:
  2026.  
  2027.      Parameter STATUS is reset to $00000000 if call to tsk_off is 
  2028. successful.   Otherwise  STATUS  is set to one of  the  following 
  2029. error conditions, right justified within the long word:
  2030.  
  2031.      $01 : The task you tried to turn off is already off.
  2032.      $02 : There is no inactive task with that i.d. number.
  2033.      $03 : There are no active or inactive tasks (a RAM problem).
  2034.      $04 : There are no inactive tasks at the moment.
  2035.      $05 : There is no registered task with that i.d. number. 
  2036.       -1 : Illegal entry from system mode.
  2037.  
  2038.  
  2039.  
  2040.  
  2041. Copyright (C) 1986, 1987 by Creative Software Technology      2-6
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047. Advance Operating System                                Chapter 2
  2048.  
  2049.  
  2050. NAME:  tsk_stat
  2051.  
  2052. DESCRIPTION:
  2053.  
  2054.      System  call  tsk_stat returns the status of  the  requested 
  2055. task.  A registered task can be in one of two basic states: on or 
  2056. off.
  2057.  
  2058. ENTRY CONDITIONS:  User Mode or System Mode.
  2059.  
  2060. TYPICAL USAGE:    tsk_stat ( communications, &tstatus );
  2061.  
  2062. ASSEMBLY INTERFACE:
  2063.  
  2064.           LINK      A6,#-PARAMETER_TABLE
  2065.           LEA.L     -TSTATUS(A6),A0
  2066.           MOVE.L    #TSK_STAT,D0
  2067.           MOVE.L    #TASK4,D1
  2068.           TRAP      #1
  2069.           TST.L     (A0)
  2070.           BEQ.S     ITS_OFF
  2071.           BSR       GET_STAT     A0 POINTS TO USEFUL TASK STATUS;
  2072. ITS_OFF   EQU       $
  2073.  
  2074. PARAMETERS:
  2075.  
  2076.      D0 = command long word;  D1 = target task;  and A0 = pointer 
  2077. to tstatus long word.
  2078.  
  2079. REGISTERS CHANGED:  None.
  2080.  
  2081. CAVEATS:  None.
  2082.  
  2083. RETURN VALUES:
  2084.  
  2085.      Register  A0 will point to a tstatus long word that contains 
  2086. one of the following bytes of information right justified  within 
  2087. the long word:
  2088.  
  2089.      $00 : The requested task is currently not active
  2090.      $01 : The requested task is in the active state
  2091.      $02 : There is no registered task with that id number.
  2092.  
  2093.  
  2094.  
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107. Copyright (C) 1986, 1987 by Creative Software Technology      2-7
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113. Advance Operating System                                Chapter 2
  2114.  
  2115.  
  2116. NAME:  tsk_id
  2117.  
  2118. DESCRIPTION:
  2119.  
  2120.      System call tsk_id returns the task id of the calling  task.  
  2121. Sometimes  a  task will make a call to a general purpose  subrou-
  2122. tine.   The  subroutine may occationally need to know which  task 
  2123. called it.  The subroutine makes a "tsk_id" system call to deter-
  2124. mine which task called it.   The id of the calling task might  be 
  2125. used as some type of index into a parameter table.
  2126.  
  2127. ENTRY CONDITIONS:  User Mode only.
  2128.  
  2129. TYPICAL USAGE:    tsk_id ( &tstatus, &status );
  2130.  
  2131. ASSEMBLY INTERFACE:
  2132.  
  2133.           LINK      A6,#-PARAMETER_TABLE
  2134.           LEA.L     -STATUS(A6),A1
  2135.           LEA.L     -TSTATUS(A6),A0
  2136.           MOVE.L    #TSK_ID,D0
  2137.           TRAP      #1
  2138.  
  2139. PARAMETERS:
  2140.  
  2141.      D0 = command long word;  A0 = pointer to tstatus long  word.  
  2142. A1 = address of STATUS long word.
  2143.  
  2144. REGISTERS CHANGED:  None.
  2145.  
  2146. CAVEATS:  None.
  2147.  
  2148. RETURN VALUES:
  2149.  
  2150.      Register  A0  will point to the long word equivalent of  the 
  2151. task id of the calling task.  The id is right justfied within the 
  2152. long  word.   The  data  that A1 points to will normally  not  be 
  2153. modified.  If tsk_id is invoked from the system mode however, and 
  2154. register A1 does not contain a $00000000, then the long word that 
  2155. A1 is pointing to will contain a -1.
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173. Copyright (C) 1986, 1987 by Creative Software Technology      2-8
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179. Advance Operating System                                Chapter 2
  2180.  
  2181.  
  2182. NAME:  post_box
  2183.  
  2184. DESCRIPTION:
  2185.  
  2186.      This  call will post the address of your "mailbox" with AOS.  
  2187. Your  post_box  call will point to the "mailbox"  on  your  stack 
  2188. frame  (or  static ram area).   Every task wishing to use  system 
  2189. functions  "send" and "receive" must first post the  location  of 
  2190. its  mailbox with ADVANCE.   Figure 2-1 shows the structure of  a 
  2191. task's  mailbox  when  set up in a stack frame.   A  stack  frame 
  2192. mailbox puts the parameters in memory from high address memory to 
  2193. low address 68000 memory.   You may also set up your mailbox in a 
  2194. static ram area.   Figure 2-2 shows that the stucture looks back-
  2195. wards but is the same as Figure 2-1.   In both cases the  ADVANCE 
  2196. send  and  receive software expects the mailbox parameters to  be 
  2197. organized as the relative hexadecimal offsets suggest.
  2198.  
  2199.  
  2200.  
  2201.  
  2202.  
  2203.  
  2204.                                                 
  2205.             _____                               
  2206.            |  |  |                              
  2207.    $XX1A  MAIL FLAG                             
  2208.            |__|__|                              
  2209.            |  |  |                              
  2210.    $XX18  MAX LETRS                             
  2211.            |__|__|_____             ___________ 
  2212.            |  |  |  |  |           |  |  |  |  |
  2213.    $XX14   | SENDER #1 |    $XX10  | PTR 2 MSG |
  2214.            |__|__|__|__|           |__|__|__|__|
  2215.            |  |  |  |  |           |  |  |  |  |
  2216.    $XX0C   | SENDER #2 |    $XX08  | PTR 2 MSG |
  2217.            |__|__|__|__|           |__|__|__|__|
  2218.            |  |  |  |  |           |  |  |  |  |
  2219.    $XX04   | SENDER #3 |    $XX00  | PTR 2 MSG |
  2220.            |__|__|__|__|           |__|__|__|__|
  2221.  
  2222.  
  2223.  
  2224.  
  2225.  
  2226.  
  2227.  
  2228.  
  2229.                            Figure 2-1
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239. Copyright (C) 1986, 1987 by Creative Software Technology      2-9
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245. Advance Operating System                                Chapter 2
  2246.  
  2247.  
  2248.  
  2249.                                                 
  2250.                                                 
  2251.             ___________             ___________ 
  2252.            |  |  |  |  |           |  |  |  |  |
  2253.    $XX00   | PTR 2 MSG |    $XX04  | SENDER #3 |
  2254.            |__|__|__|__|           |__|__|__|__|
  2255.            |  |  |  |  |           |  |  |  |  |
  2256.    $XX08   | PTR 2 MSG |    $XX0C  | SENDER #2 |
  2257.            |__|__|__|__|           |__|__|__|__|
  2258.            |  |  |  |  |           |  |  |  |  |
  2259.    $XX10   | PTR 2 MSG |    $XX14  | SENDER #1 |
  2260.            |__|__|__|__|           |__|__|__|__|
  2261.            |  |  |                              
  2262.    $XX18  MAX LETRS                             
  2263.            |__|__|                              
  2264.            |  |  |                              
  2265.    $XX1A  MAIL FLAG                             
  2266.            |__|__|                              
  2267.  
  2268.  
  2269.  
  2270.  
  2271.                            Figure 2-2
  2272.  
  2273.  
  2274. ENTRY CONDITIONS: User Mode only
  2275.  
  2276. TYPICAL USAGE:    post_box ( &mailbox, &status );
  2277.  
  2278. ASSEMBLY INTERFACE:
  2279.  
  2280.      LOCALS    EQU      0
  2281.      EMPTY     EQU      0
  2282.      BOX       EQU      4       This mailbox holds 4 letters;
  2283.      MSIZE     EQU      8
  2284.      ROM       EQU      $XXXX   Set to point to ROM adr;
  2285.  
  2286.                ORG      LOCALS
  2287.      A6LINK    RMB       4
  2288.      STATUS    RMB       4              OPT SYS STATUS FLAG.
  2289.                RMB       2              MAILBOX FLAG.
  2290.      ML_FLAG   EQU       $-STATUS
  2291.  
  2292.                RMB       2              RESV SPACE 4 MAXIMUM
  2293.      MX_LTRS   EQU       $-STATUS       NUMBER OF "LETTERS;"
  2294.  
  2295.      VOLUME    RMB       MSIZE*BOX      RESERVE TOTAL MSG SPACE;
  2296.      PARAMS    EQU       $-STATUS       COMPUTE STACK FRAME SIZ;
  2297.  
  2298.      MAIL      EQU       $-VOLUME       BYTE SIZE OF MBOX;
  2299.      LETTERS   EQU       MAIL/4         MAX NUMBER OF LETTERS;
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305. Copyright (C) 1986, 1987 by Creative Software Technology      2-10
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311. Advance Operating System                                Chapter 2
  2312.  
  2313.  
  2314.                ORG       ROM
  2315.      LINK      A6,#-PARAMS              RESERVE SPACE FOR MAIL;
  2316.      LEA.L     -ML_FLAG(A6),A0          A0 <- ADR TASK #5'S MBOX;
  2317.      LEA.L     -STATUS(A6),A1           A1 <- ADR OF STATUS LWORD;
  2318.      MOVE.W    #EMPTY,-ML_FLAG(A6)      ML_FLAG <-- 0;
  2319.      MOVE.W    #LETTERS,-MX_LTRS(A6)    MX_LTRS <-- MAX LETTERS;
  2320.      MOVE.L    #POSTBX,D0               D0 <-- POST BOX COMMAND;
  2321.      TRAP      #1                       POST ADDRESS OF MAILBOX;
  2322.  
  2323. PARAMETERS:
  2324.  
  2325.      D0  = command long word;   A0 = pointer to caller's mailbox.  
  2326. A1 = address of STATUS long word.
  2327.  
  2328. REGISTERS CHANGED: none
  2329.  
  2330. CAVEATS:
  2331.  
  2332.      Mail consists of "letters."  Letters consist of 4 bytes that 
  2333. contain  the  task number,  or i.d.  number of the sending  task, 
  2334. right justified within the long word,  and a pointer to the call-
  2335. ing task's message,  also one long word (4 bytes).   The  calling 
  2336. task is responsible for setting up the number of letters that his 
  2337. mailbox can hold. Each task's mailbox can hold as many letters as 
  2338. there are registered tasks,  plus one.   If the calling task does 
  2339. not  set up mailbox parameter "MAX_LTRS," then one of two  things 
  2340. may happen.
  2341.  
  2342.      1)  If the parameter is equal to 0,  then ADVANCE  considers 
  2343. this  to  mean  that the receiving task does not  want  any  mail 
  2344. delivered  at  the moment.   A task sending a message to  another 
  2345. task who set MAX_LTRS parameter = 0 will be returned an $07 code.
  2346.  
  2347.      2)  If parameter "MAX_LTRS" is greater than the total number 
  2348. of registered tasks,  plus one,  then ADVANCE will use the number 
  2349. of registered tasks, plus one, as parameter "MAX_LTRS" and ignore 
  2350. your mailbox MAX_LTRS parameter.
  2351.  
  2352.      When a task receives a letter, parameter "MAIL_FLAG" will be 
  2353. set  to  some non-zero value.   It is the responsibility  of  the 
  2354. receiving  task  to clear parameter MAIL_FLAG to  zero  prior  to 
  2355. making  the  "receive" system call.   ADVANCE does not care  what 
  2356. parameter MAIL_FLAG was before the mail is sent.   The  receiving 
  2357. task can also ignore parameter MAIL_FLAG if it wants to, however, 
  2358. it  may  be  hard  for the receiving task to  determine  if  mail 
  2359. arrives.  
  2360.  
  2361. RETURN VALUES:
  2362.  
  2363.      If  post_box is illegally entered from the system mode  then 
  2364. if A1 does not point to $00000000,  the data that A1 points to is 
  2365. set equal to -1.
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371. Copyright (C) 1986, 1987 by Creative Software Technology      2-11
  2372.  
  2373.  
  2374.  
  2375.  
  2376.  
  2377. Advance Operating System                                Chapter 2
  2378.  
  2379.  
  2380. NAME:  send
  2381.   
  2382. DESCRIPTION:
  2383.  
  2384.      If  a certain task wants to communicate with  another  task, 
  2385. the  calling task "sends" information ( a four byte pointer )  to 
  2386. the  destination  mailbox.   The sending task need not  know  the 
  2387. address of the destination mailbox, ADVANCE knows the location of 
  2388. each  task's  registered mailbox.   In order for "send"  to  work 
  2389. successfully,  the  target  mailbox had to have  been  previously 
  2390. posted by the receiving task's "post_box" function call.
  2391.  
  2392.      System call "send" will also turn on the target task if  the 
  2393. target  task is inactive and waiting for a message from the call-
  2394. ing task.  See system call "receive" for more details.
  2395.  
  2396.      System  call  "send" can be invoked from the system mode  as 
  2397. well as from the user mode.  There are some differences, however.  
  2398. Send calculates the id of the task making the call to itself.  If 
  2399. the  call was made from the user mode,  then the id of  the  task 
  2400. that  made the call to send is placed in the receiver's  mailbox.  
  2401. If the call to send was made from the system mode,  then an id of 
  2402. -1  is  placed in the receiver's mailbox.   A task id of -1 is  a 
  2403. sign,  therefore,  to the receiver that it has received a message 
  2404. from some interrupt service routine.   If send is called from the 
  2405. system  mode then a rescheduling of tasks is not  performed.   If 
  2406. send  is called from the user mode,  however,  a rescheduling  of 
  2407. tasks will occur.
  2408.  
  2409. ENTRY CONDITIONS:   User Mode or System Mode
  2410.  
  2411. TYPICAL USAGE:  send ( target_task, &message, &stat );
  2412.  
  2413. ASSEMBLY INTERFACE:
  2414.  
  2415.           LINK      A6,#-PARAMETER_TABLE     This example shows
  2416.           LEA.L     -STATUS(A6),A1           a position indepen-
  2417.           MOVE.L    #SEND,D0                 dent status flag.
  2418.           MOVE.L    #TASKNO,D1
  2419.           MOVE.L    #MSG,A0
  2420.           TRAP      #1
  2421.           TST.L     (A1)
  2422.           BEQ.S     NO_ERROR
  2423.           BSR       ERROR_MSG      A1 POINTS TO USEFUL ERROR DATA;
  2424. NO_ERROR  EQU       $
  2425.  
  2426. PARAMETERS:
  2427.  
  2428.      D0 = command long word;  D1 = task to receive message;  A0 = 
  2429. pointer  to  the  calling task's message;   and A1 =  pointer  to 
  2430. status long word.
  2431.  
  2432. REGISTERS CHANGED:  None.
  2433.  
  2434.  
  2435.  
  2436.  
  2437. Copyright (C) 1986, 1987 by Creative Software Technology      2-12
  2438.  
  2439.  
  2440.  
  2441.  
  2442.  
  2443. Advance Operating System                                Chapter 2
  2444.  
  2445.  
  2446. CAVEATS:
  2447.  
  2448.      Task  alpha,  for  example,  can send many messages to  task 
  2449. beta.   System  command send will place task alpha's task  id  in 
  2450. task  beta's  mailbox,  along  with a four byte pointer  to  some 
  2451. message.  Task beta must read (process) the message and clear the 
  2452. task  id in its mailbox.   If task beta has cleared the  task  id 
  2453. slot ( that had alpha's task id in it) in its mailbox before task 
  2454. alpha sends another message to it, then the new message from task 
  2455. alpha is received with no problems and no error returns.   On the 
  2456. other hand, if task beta has not cleared out task alpha's task id 
  2457. slot  in  beta's mailbox,  then task alpha cannot send  a  second 
  2458. message to task beta successfully.  
  2459.  
  2460. RETURN VALUES:
  2461.  
  2462.      STATUS is set to $00000000 if the calling task  successfully 
  2463. sends  its message.   If an error occurs,  then STATUS is set  to 
  2464. equal  one  of the following error  conditions,  right  justified 
  2465. within the long word:
  2466.  
  2467.      $05 : Target Task has not registered his mail box location
  2468.      $06 : Unread mail from calling task in target task's mailbox
  2469.      $07 : No available message slots in target task's mailbox
  2470.  
  2471.      Because "send" occationally calls "tsk_on" there is a chance 
  2472. that one of these other errors codes will be returned:
  2473.  
  2474.      $01 : The task you tried to turn on is already on.
  2475.      $02 : There is no inactive task with that i.d. number.
  2476.      $03 : There are no active or inactive tasks.
  2477.      $04 : There are no inactive tasks at the moment.
  2478.  
  2479.  
  2480.  
  2481.  
  2482.  
  2483.  
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503. Copyright (C) 1986, 1987 by Creative Software Technology      2-13
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509. Advance Operating System                                Chapter 2
  2510.  
  2511.  
  2512. NAME:  receive
  2513.  
  2514. DESCRIPTION:
  2515.  
  2516.      Each  task knows the location of its mailbox.   A task could 
  2517. easily  monitor the mail flag "on" its mailbox for new mail.   If 
  2518. the  mail flag is set to some non-zero value a task could  "open" 
  2519. the box and get its own "letter."  System command "receive"  lets 
  2520. a  task shut off until it receives a letter from another task.
  2521.  
  2522.      This  command  initiates the turning on of the calling  task 
  2523. once per call.  Other tasks wanting to send mail to the receiving 
  2524. task will not keep trying to turn on the target task.   The first 
  2525. (requested)  task in with the mail turns on the  receiving  task.  
  2526. The  other tasks wanting to send mail to the receiving task  just 
  2527. drop off their letters via the system command "send."
  2528.  
  2529. ENTRY CONDITIONS:   User Mode only.
  2530.  
  2531. TYPICAL USAGE:  receive ( activator_task, &status );
  2532.  
  2533.      NOTE - If activator_task = $00000000 then mail from any task
  2534.             will turn on the waiting task.  If the activator_task
  2535.             = -1, then  only a message from  an interrupt service
  2536.             routine will turn on the waiting task. 
  2537.  
  2538. ASSEMBLY INTERFACE:
  2539.  
  2540.      LEA.L     -STATUS(A6),A1    STATUS IS STACKED PARAMETER
  2541.      MOVE.L    #RECEIVE,D0
  2542.      MOVE.L    #TASK3,D1
  2543.      TRAP      #1
  2544.  
  2545. PARAMETERS:
  2546.  
  2547.      D0 = command long word;   D1 = activator task;  A1 = pointer 
  2548. to status long word.
  2549.  
  2550. REGISTERS CHANGED:  None.
  2551.  
  2552. CAVEATS:
  2553.  
  2554.      Mail consists of "letters."  Letters consist of 4 bytes that 
  2555. contain  the  task number,  or i.d.  number of the sending  task, 
  2556. right justified within the long word,  and a pointer to the call-
  2557. ing task's message,  also one long word (4 bytes).   The  calling 
  2558. task is responsible for setting up the number of letters that his 
  2559. mailbox can hold. Each task's mailbox can hold as many letters as 
  2560. there are registered tasks,  plus one.   If the calling task does 
  2561. not  set up mailbox parameter "MAX_LTRS," then one of two  things 
  2562. may happen.
  2563.  
  2564.      1)     ADVANCE checks parameter MAX_LTRS prior to  entry  to 
  2565. system  call receive.   ADVANCE will not let a task enter  system 
  2566. call receive if the calling task's MAX_LTRS parameter is equal to 
  2567.  
  2568.  
  2569. Copyright (C) 1986, 1987 by Creative Software Technology      2-14
  2570.  
  2571.  
  2572.  
  2573.  
  2574.  
  2575. Advance Operating System                                Chapter 2
  2576.  
  2577.  
  2578. zero.  ADVANCE  normally  considers a MAX_LTRS parameter of 0  to 
  2579. mean that the receiving task does not want any mail delivered  at 
  2580. the  moment.  If task ALPHA sends a message to task BETA,  and if 
  2581. BETA has set MAX_LTRS parameter = 0,  task ALPHA will be returned 
  2582. an $07 error code.
  2583.  
  2584.      2)  If parameter "MAX_LTRS" is greater than the total number 
  2585. of registered tasks,  plus one,  then ADVANCE will use the number 
  2586. of registered tasks, plus one, as parameter "MAX_LTRS" and ignore 
  2587. your  mailbox MAX_LTRS parameter.   The task's MAX_LTRS parameter 
  2588. is not changed by ADVANCE.
  2589.  
  2590.      Before  a  task makes a call to system  call  "receive,"  it 
  2591. should read any current mail in their mailbox.  If a task has old 
  2592. mail in it's mailbox, it should clear the sender's TASK_NO, or ID 
  2593. to  zero to indicate that the mail slot is empty.   An emply mail 
  2594. slot can be re-used by ADVANCE for new mail.  Its O.K. for a task 
  2595. to leave unread mail in its mailbox prior to its making a call to 
  2596. receive.   ADVANCE,  however, does not use mail slots with sender 
  2597. ids left in them.   If a task has a lot of slots in its mail  box 
  2598. tied  up  with sender ids in them,   a task making a call to  the 
  2599. task with the full mail box may not have a place to put new mail.
  2600.  
  2601.      When a task receives a letter, parameter "MAIL_FLAG" will be 
  2602. set  to  some non-zero value.   It is the responsibility  of  the 
  2603. receiving  task  to  clear parameter MAIL_FLAG to zero  prior  to 
  2604. making the "receive" system call.   Before ADVANCE puts the call-
  2605. ing  task in the inactive state,  ( from within the  system  call 
  2606. "receive"  ),  it checks to see if the caller's mail flag is set.  
  2607. If  the mail flag is set then ADVANCE scans the caller's  mailbox 
  2608. to see if the requested activator task has sent mail to the  task 
  2609. that  is  making the call to system call  receive.   This  action 
  2610. prevents a "deadlock" situation.
  2611.  
  2612.      ADVANCE's  system call "receive" will sometimes  return  the 
  2613. caller  to receive back to the instruction just past the TRAP  #1 
  2614. instruction,  without  placing  the calling task in the  inactive 
  2615. state.   This  occurs whenever the caller's mail flag is  already 
  2616. set to some non-zero value and ADVANCE finds mail in the caller's 
  2617. mail  box from the requested activator task.   This  also  occurs 
  2618. whenever  the caller's mail flag is already set to some  non-zero 
  2619. value,  there is a sender id in the caller's mailbox ( within the 
  2620. MAX_LTRS range ),  and the caller's activator task is equal to 0.  
  2621. These situations are not defined as error conditions.  
  2622.  
  2623. RETURN VALUES:
  2624.  
  2625.      Parameter  STATUS  is reset to $00000000 if  no  errors  are 
  2626. detected.   Otherwise STATUS is set to one of the following error 
  2627. conditions, right justified within the long word:
  2628.  
  2629.      $06 : Calling task did not first register his mailbox.
  2630.      $07 : No activator task with given task ID number.
  2631.      $08 : Calling task's MAX_LTRS parameter = 0.
  2632.       -1 : Illegal entry from the system mode.
  2633.  
  2634.  
  2635. Copyright (C) 1986, 1987 by Creative Software Technology      2-15
  2636.  
  2637.  
  2638.  
  2639.  
  2640.  
  2641. Advance Operating System                                Chapter 2
  2642.  
  2643.  
  2644. NAME:  sendx
  2645.   
  2646. DESCRIPTION:
  2647.  
  2648.      If  a  certain task wants to communicate with another  task, 
  2649. the  calling task "sends" information ( a four byte pointer )  to 
  2650. the  destination  mailbox.   The sending task need not  know  the 
  2651. address of the destination mailbox, ADVANCE knows the location of 
  2652. each  task's registered mailbox.   In order for "sendx"  to  work 
  2653. successfully,  the  target  mailbox had to have  been  previously 
  2654. posted by the receiving task's "post_box" function call.
  2655.  
  2656.      System call "sendx" will also turn on the target task if the 
  2657. target  task is inactive and waiting for a message from the call-
  2658. ing task.  See system call "receive" for more details.
  2659.  
  2660.      System  call "sendx" can be invoked from the system mode  as 
  2661. well as from the user mode.  There are some differences, however.  
  2662. Send  (without the "x") calculates the id of the task making  the 
  2663. call to itself.   If the call was made from the user  mode,  then 
  2664. the  id  of the task that made the call to send is placed in  the 
  2665. receiver's mailbox.  If the call to send was made from the system 
  2666. mode,  then an id of -1 is placed in the receiver's  mailbox.   A 
  2667. task id of -1 is a sign,  therefore,  to the receiver that it has 
  2668. received a message from some interrupt service routine.  
  2669.  
  2670.      Sendx  performs the same as Send but will not place a -1  as 
  2671. the  task_id in the receiver's mailbox if it was invoked from the 
  2672. system mode.  This is useful whenever a calling task finds itself 
  2673. in the system mode for whatever reason.  The task that was in the 
  2674. system  mode  will want the correct id placed in  the  receiver's 
  2675. mailbox,  not  a  -1 as system call "send" would have done  in  a 
  2676. similar situation.   If sendx is called from the system mode then 
  2677. a rescheduling of tasks is not performed.   There is no reason to 
  2678. invoke  sendx from the user mode,  as the application should  use 
  2679. "send"  for that mode.   Sendx was made for special  system  mode 
  2680. cases.   Remember,  true  hardware  interrupt routines  must  use 
  2681. "send", not "sendx".
  2682.  
  2683. ENTRY CONDITIONS:   System Mode (User Mode not recommended)
  2684.  
  2685. TYPICAL USAGE:  sendx ( target_task, &message, &stat );
  2686.  
  2687. ASSEMBLY INTERFACE:
  2688.  
  2689.           LINK      A6,#-PARAMETER_TABLE     This example shows
  2690.           LEA.L     -STATUS(A6),A1           a position indepen-
  2691.           MOVE.L    #SENDX,D0                dent status flag.
  2692.           MOVE.L    #TASKNO,D1
  2693.           MOVE.L    #MSG,A0
  2694.           TRAP      #1
  2695.           TST.L     (A1)
  2696.           BEQ.S     NO_ERROR
  2697.           BSR       ERROR_MSG      A1 POINTS TO USEFUL ERROR DATA;
  2698. NO_ERROR  EQU       $
  2699.  
  2700.  
  2701. Copyright (C) 1986, 1987 by Creative Software Technology      2-16
  2702.  
  2703.  
  2704.  
  2705.  
  2706.  
  2707. Advance Operating System                                Chapter 2
  2708.  
  2709.  
  2710. PARAMETERS:
  2711.  
  2712.      D0 = command long word;  D1 = task to receive message;  A0 = 
  2713. pointer  to  the  calling task's message;   and A1 =  pointer  to 
  2714. status long word.
  2715.  
  2716. REGISTERS CHANGED:  None.
  2717.  
  2718.  
  2719. CAVEATS:
  2720.  
  2721.      Task  alpha,  for  example,  can send many messages to  task 
  2722. beta.   System  command sendx will place task alpha's task id  in 
  2723. task  beta's  mailbox,  along with a four byte  pointer  to  some 
  2724. message.  Task beta must read (process) the message and clear the 
  2725. task  id  in its mailbox.   If task beta has cleared the task  id 
  2726. slot ( that had alpha's task id in it) in its mailbox before task 
  2727. alpha sends another message to it, then the new message from task 
  2728. alpha is received with no problems and no error returns.   On the 
  2729. other hand, if task beta has not cleared out task alpha's task id 
  2730. slot  in  beta's mailbox,  then task alpha cannot send  a  second 
  2731. message to task beta successfully.  
  2732.  
  2733. RETURN VALUES:
  2734.  
  2735.      STATUS is set to $00000000 if the calling task  successfully 
  2736. sends  its message.   If an error occurs,  then STATUS is set  to 
  2737. equal  one  of the following error  conditions,  right  justified 
  2738. within the long word:
  2739.  
  2740.      $05 : Target Task has not registered his mail box location
  2741.      $06 : Unread mail from calling task in target task's mailbox
  2742.      $07 : No available message slots in target task's mailbox
  2743.  
  2744.      Because  "sendx"  occationally  calls "tsk_on"  there  is  a 
  2745. chance that one of these other errors codes will be returned:
  2746.  
  2747.      $01 : The task you tried to turn on is already on.
  2748.      $02 : There is no inactive task with that i.d. number.
  2749.      $03 : There are no active or inactive tasks.
  2750.      $04 : There are no inactive tasks at the moment.
  2751.  
  2752.  
  2753.  
  2754.  
  2755.  
  2756.  
  2757.  
  2758.  
  2759.  
  2760.  
  2761.  
  2762.  
  2763.  
  2764.  
  2765.  
  2766.  
  2767. Copyright (C) 1986, 1987 by Creative Software Technology      2-17
  2768.  
  2769.  
  2770.  
  2771.  
  2772.  
  2773. Advance Operating System                                Chapter 2
  2774.  
  2775.  
  2776. NAME: time_set
  2777.  
  2778. DESCRIPTION:
  2779.  
  2780.      System  call time_set is how to load the system "time" para-
  2781. meter.   Parameter  time is also incremented by one every time  a 
  2782. call is made to system call "tick." 
  2783.  
  2784. ENTRY CONDITIONS:   User Mode or System Mode.
  2785.  
  2786. TYPICAL USAGE:    time_set ( time );
  2787.  
  2788. ASSEMBLY INTERFACE:
  2789.  
  2790.      MOVE.L    #TIME_SET,D0
  2791.      MOVE.L    #TIME,D1
  2792.      TRAP      #1
  2793.  
  2794. PARAMETERS:    D0  =  command long word;  D1 = time parameter;
  2795.  
  2796. REGISTERS CHANGED:  none.
  2797.  
  2798. CAVEATS:  none.
  2799.  
  2800. RETURN VALUES:  none.
  2801.  
  2802.  
  2803.  
  2804.  
  2805.  
  2806.  
  2807.  
  2808.  
  2809.  
  2810.  
  2811.  
  2812.  
  2813.  
  2814.  
  2815.  
  2816.  
  2817.  
  2818.  
  2819.  
  2820.  
  2821.  
  2822.  
  2823.  
  2824.  
  2825.  
  2826.  
  2827.  
  2828.  
  2829.  
  2830.  
  2831.  
  2832.  
  2833. Copyright (C) 1986, 1987 by Creative Software Technology      2-18
  2834.  
  2835.  
  2836.  
  2837.  
  2838.  
  2839. Advance Operating System                                Chapter 2
  2840.  
  2841.  
  2842. NAME:  time_read 
  2843.  
  2844. DESCRIPTION:
  2845.  
  2846.      This is how to read the system "time" parameter.
  2847.  
  2848. ENTRY CONDITIONS:   User Mode or System Mode.
  2849.  
  2850. TYPICAL USAGE:
  2851.  
  2852.      time_read ( &time );
  2853.  
  2854. ASSEMBLY INTERFACE:
  2855.  
  2856.      MOVE.L    #TIME_READ,D0
  2857.      MOVE.L    #TIME,A0
  2858.      TRAP      #1
  2859.  
  2860. PARAMETERS:
  2861.  
  2862.      D0 = command long word;   A0 = pointer to where you want the 
  2863. value of the system "time" parameter placed.
  2864.  
  2865. REGISTERS CHANGED:  none.
  2866.  
  2867. CAVEATS:  none.
  2868.  
  2869. RETURN  VALUES:
  2870.  
  2871.      A0 points to the value of the system time parameter.
  2872.  
  2873.  
  2874.  
  2875.  
  2876.  
  2877.  
  2878.  
  2879.  
  2880.  
  2881.  
  2882.  
  2883.  
  2884.  
  2885.  
  2886.  
  2887.  
  2888.  
  2889.  
  2890.  
  2891.  
  2892.  
  2893.  
  2894.  
  2895.  
  2896.  
  2897.  
  2898.  
  2899. Copyright (C) 1986, 1987 by Creative Software Technology      2-19
  2900.  
  2901.  
  2902.  
  2903.  
  2904.  
  2905. Advance Operating System                                Chapter 2
  2906.  
  2907.  
  2908. NAME: tick
  2909.  
  2910. DESCRIPTION:
  2911.  
  2912.      Update  the real-time clock by one unit (a single  tick)  of 
  2913. time.  After the system time parameter is incremented by one unit 
  2914. of  time,  system call tick also looks to see if any tasks are in 
  2915. the delay list.  If a task is found to be in the delay list, then 
  2916. tick will decrement the time parameter associated with that task.  
  2917. If a task times out (its time parameter decrements to  $00000000) 
  2918. then  ADVANCE  will attempt to turn on the inactive task(s)  that 
  2919. was(were)  presently in the delay list.   Tick will  process  all 
  2920. tasks  in  the delay list in the same manner.   Many tasks  could 
  2921. "spring back to life" with just a single call to tick (so long as 
  2922. each of the tasks time-out at the same time).
  2923.  
  2924.      Tick  processes the delay list for tasks currently in delay.    
  2925. System call tick has only to scan the first delay node to  deter-
  2926. mine  if there are any tasks currently in the delay  list.   Tick 
  2927. does  not  scan some fixed-length delay list.  If there  are  two 
  2928. tasks somewhere in the delay list then system call tick will have 
  2929. spent  time  scanning and processing only those two delay  nodes.  
  2930. There is therefore very little overhead in the tick software.
  2931.  
  2932. TYPICAL USAGE:      tick ();
  2933.  
  2934. ENTRY CONDITIONS:   User Mode or System Mode.
  2935.  
  2936. ASSEMBLY INTERFACE:
  2937.  
  2938.      MOVE.L    #TICK,D0
  2939.      TRAP      #1
  2940.  
  2941. PARAMETERS:    D0 = command long word.
  2942.  
  2943. REGISTERS CHANGED: none
  2944.  
  2945. CAVEATS:
  2946.  
  2947.      If tick finds a task that has timed out,  then ADVANCE  will 
  2948. turn  on  the  inactive  task and place him at  the  end  of  the 
  2949. dispatch queue.
  2950.  
  2951. RETURN VALUES: none
  2952.  
  2953.  
  2954.  
  2955.  
  2956.  
  2957.  
  2958.  
  2959.  
  2960.  
  2961.  
  2962.  
  2963.  
  2964.  
  2965. Copyright (C) 1986, 1987 by Creative Software Technology      2-20
  2966.  
  2967.  
  2968.  
  2969.  
  2970.  
  2971. Advance Operating System                                Chapter 2
  2972.  
  2973.  
  2974. NAME:  delay
  2975.  
  2976. DESCRIPTION:
  2977.  
  2978.      Delay  by some number of ticks,  a tick being the basic unit 
  2979. of time.   This call will automatically inactivate (turn off) the 
  2980. calling task.  The calling task's stack is preserved intact.
  2981.  
  2982. TYPICAL USAGE:
  2983.  
  2984.      delay ( ticks, &status );
  2985.  
  2986. ENTRY CONDITIONS:   User Mode Only.
  2987.  
  2988. ASSEMBLY INTERFACE:
  2989.  
  2990.      LINK      A6,#-PARAMETER_TABLE
  2991.      LEA.L     -STATUS(A6),A1
  2992.      MOVE.L    #500,D1                  AMOUNT OF TICKS TO DELAY;
  2993.      MOVE.L    #TIME,D0                 COMMAND WORD PLACED IN D0;
  2994.      TRAP      #1
  2995.  
  2996. PARAMETERS:
  2997.  
  2998.      D0 = command long word;   D1 = number of ticks to delay;  A1 
  2999. = STATUS long word.
  3000.  
  3001. ENTRY CONDITIONS:   User Mode only.
  3002.  
  3003. REGISTERS CHANGED:  none.
  3004.  
  3005. CAVEATS:
  3006.  
  3007.      The task making the call to delay will be de-activated until 
  3008. his timer has timed-out.   When a sufficient number of TICKs have 
  3009. occurred,  then  the  task is re-activated by placing it  at  the 
  3010. bottom of the current active process queue.   This means that the 
  3011. system  call  "tick" must be used to eventually  re-activate  the 
  3012. tasks that have made a call to "delay."
  3013.  
  3014. RETURN VALUES:
  3015.  
  3016.      If delay is invoked from the system mode,  which is an ille-
  3017. gal condition, and register A1 does not contain a $00000000, then 
  3018. the long word that A1 is pointing to will contain a -1.
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.  
  3031. Copyright (C) 1986, 1987 by Creative Software Technology      2-21
  3032.  
  3033.  
  3034.  
  3035.  
  3036.  
  3037. Advance Operating System                                Chapter 2
  3038.  
  3039.  
  3040. NAME:  put_char
  3041.  
  3042. DESCRIPTION:
  3043.  
  3044.      Put a character to the default I/O device.
  3045.  
  3046. ENTRY CONDITIONS:   User Mode only.
  3047.  
  3048. TYPICAL USAGE:
  3049.  
  3050.      put_char ( character );
  3051.      
  3052. ASSEMBLY INTERFACE:
  3053.  
  3054.      MOVE.L    #CHAR,D1
  3055.      MOVE.L    #PUT_CHAR,D0
  3056.      TRAP      #1
  3057.  
  3058. PARAMETERS:
  3059.  
  3060.      D0  = command long word.   D1 = byte of data to send to  the 
  3061. default  output device.   The byte of data to be output is  right 
  3062. justified (in the low byte of the low word) within D1.
  3063.  
  3064. REGISTERS CHANGED:  none.
  3065.  
  3066. CAVEATS:
  3067.  
  3068.      If the system designer does not set up the "SERVPTR" parame-
  3069. ter  out_character  properly (see chapter one) then ADVANCE  will 
  3070. not output characters to the default output device.   If  SERVPTR 
  3071. is  set to some non-zero value,  and the second long word in  the 
  3072. SERVPTR table (the table that SERVPTR points to) is non-zero,  it 
  3073. should  be a pointer to out_character (or some other routine with 
  3074. an  RTS  at  the end of it) or the processor may  end  up  in  an 
  3075. illegal  instruction exception.   If you do not want to use  this 
  3076. command and you do not want to use in_command, then set parameter 
  3077. SERVPTR equal to 0.
  3078.  
  3079. RETURN VALUES: none
  3080.  
  3081.  
  3082.  
  3083.  
  3084.  
  3085.  
  3086.  
  3087.  
  3088.  
  3089.  
  3090.  
  3091.  
  3092.  
  3093.  
  3094.  
  3095.  
  3096.  
  3097. Copyright (C) 1986, 1987 by Creative Software Technology      2-22
  3098.  
  3099.  
  3100.  
  3101.  
  3102.  
  3103. Advance Operating System                                Chapter 2
  3104.  
  3105.  
  3106. NAME:  get_char
  3107.  
  3108. DESCRIPTION:
  3109.  
  3110.      Get a character from the default I/O device.
  3111.  
  3112. ENTRY CONDITIONS:   User Mode only.
  3113.  
  3114. TYPICAL USAGE:
  3115.  
  3116.      character = get_char();
  3117.      
  3118. ASSEMBLY INTERFACE:
  3119.  
  3120.      LEA.L     CHARACTER(PC),A0
  3121.      MOVE.L    #GET_CHAR,D0
  3122.      TRAP      #1
  3123.  
  3124. PARAMETERS:
  3125.  
  3126.      D0 = command long word;  A0 = the address where you want the 
  3127. character to be placed.
  3128.  
  3129. REGISTERS CHANGED:  None.
  3130.  
  3131. CAVEATS:
  3132.  
  3133.      If the system designer does not set up the "SERVPTR" parame-
  3134. ter in_character properly (see chapter one) then ADVANCE will not 
  3135. input  characters from the default input device.   If SERVPTR  is 
  3136. set  to  some  non-zero value,  and the first long  word  in  the 
  3137. SERVPTR table (the table that SERVPTR points to) is non-zero,  it 
  3138. should  be a pointer to in_character (or some other routine  with 
  3139. an  RTS  at  the  end of it) or the processor may end  up  in  an 
  3140. illegal  instruction exception.   If you do not want to use  this 
  3141. command and you do not want to use out_command,  then set parame-
  3142. ter SERVPTR equal to 0.
  3143.  
  3144. RETURN VALUES:
  3145.  
  3146.      A0 points to the address of the newly entered character.
  3147.  
  3148.  
  3149.  
  3150.  
  3151.  
  3152.  
  3153.  
  3154.  
  3155.  
  3156.  
  3157.  
  3158.  
  3159.  
  3160.  
  3161.  
  3162.  
  3163. Copyright (C) 1986, 1987 by Creative Software Technology      2-23
  3164.  
  3165.  
  3166.  
  3167.  
  3168.  
  3169. Advance Operating System                                Chapter 2
  3170.  
  3171.  
  3172. NAME:  key_stat1
  3173.  
  3174. DESCRIPTION:
  3175.  
  3176.      See if there is a character ready at the default I/O device.  
  3177. The  user-supplied  device driver must set the carry bit  in  the 
  3178. condition  code register if a character is ready,  and clear  the 
  3179. carry  bit  if a character is not  ready.   User-supplied  device 
  3180. driver must preserve registers A6 and A7.
  3181.  
  3182. ENTRY CONDITIONS:   User Mode only.
  3183.  
  3184. TYPICAL USAGE:
  3185.  
  3186.      key_stat1 ( &err_stat, &dev_stat );
  3187.      
  3188. ASSEMBLY INTERFACE:
  3189.  
  3190.           LINK      A5,#-PARM_TABLE
  3191. NO_CHR    LEA.L     -ERR_STAT(A5),A1         TEL AOS/68K WHERE TO PUT
  3192.           LEA.L     -DEV_STAT(A5),A0         ER STAT AND DEVICE STAT.
  3193.           MOVE.L    #KEY_STAT1,D0            (KEY_STAT1 EQU $0000001A)
  3194.           TRAP      #1                       FORMAL AOS/68K CALL.
  3195.           MOVE.L    (A1),D1                  IF A1 POINTS TO TO A NON-
  3196.           BNE.S     $                        ZERO VALUE, NO EXIT.
  3197.           MOVE.L    (A0),D1                  NOW GET DEVICE STATUS.
  3198.           BEQ.S     NO_CHR                   JUMP IF NO CHAR IS READY.
  3199.  
  3200. PARAMETERS:
  3201.  
  3202.      D0 = command long word;  A0 = the address where you want the 
  3203. status ( of the default i/o port) to be placed.
  3204.  
  3205. REGISTERS CHANGED:  None.
  3206.  
  3207. CAVEATS:
  3208.  
  3209.      If the system designer does not set up the "SERVPTR" parame-
  3210. ter  key_stat1  properly (see chapter one) then ADVANCE will  not 
  3211. attempt to call the key_stat1 routine.  If SERVPTR is set to some 
  3212. non-zero value, and the third long word in the SERVPTR table (the 
  3213. table that SERVPTR points to) is non-zero, it should be a pointer 
  3214. to key_stat (or some other routine with an RTS at the end of it).
  3215.  
  3216. RETURN VALUES:
  3217.  
  3218.      The long word that A1 points to will be equal to either a:
  3219.        Zero     = no problems.
  3220.        Non-zero = no key_stat1 vector was found by AOS/68K
  3221.  
  3222.      The long word that A0 points to will be equal to either a:
  3223.        Zero     = no character ready at the i/o device.
  3224.        Non-zero = a character is ready at the i/o device.
  3225.  
  3226.  
  3227.  
  3228.  
  3229. Copyright (C) 1986, 1987 by Creative Software Technology      2-24
  3230.  
  3231.  
  3232.  
  3233.  
  3234.  
  3235. Advance Operating System                                Chapter 2
  3236.  
  3237.  
  3238. ADDITIONAL KEY_STAT EXAMPLES:
  3239.  
  3240.      Here  is  an assembly language example on how to get a  character 
  3241. from the user i/o device - and - let the other tasks,  task-share 
  3242. the processor:
  3243.  
  3244. *  Initialize as necessary:
  3245. *
  3246.           LINK      A5,#-PARM_TABLE
  3247. *
  3248. NO_CHAR   LEA.L     -ERR_STAT(A5),A1    <- Main task-share loop.
  3249.           LEA.L     -DEV_STAT(A5),A0    Notice that you do not
  3250.           MOVE.L    #KEY_STAT1,D0       need a TRAP #0 anywhere.
  3251.           TRAP      #1                  TRAP #1 will task-share.
  3252. *
  3253. *  Optional:   If you want to you  may check to see what register 
  3254. *  A1 is pointing to.  If A1 points to a long word that has a non 
  3255. *  zero  value,  then  exit with some error  because  AOS/68K  is 
  3256. *  saying  that it cannot find the key_stat1 vector in the config 
  3257. *  table. If A1 points to a long word that has a zero value, then 
  3258. *  continue your processing.
  3259. *
  3260.           MOVE.L    (A1),D1        SEE WHAT A1 IS POINTING TO.
  3261.           BNE.S     ERROR
  3262. *
  3263. *  If the device status long word that A0 points to is equal to a 
  3264. *  $00000000,  then  there are no characters  ready at the  input 
  3265. *  device.   If the device status  long word that A0 points to is 
  3266. *  equal to a non-zero quantity,  then you have a character ready
  3267. *  at the default i/o device.
  3268. *
  3269.           MOVE.L    (A0),D1
  3270.           BEQ.S     NO_CHAR        IF D1 = 0, THEN NO CHARACTER.
  3271. *
  3272. *  Now you know that a character is ready, make call to get_char:
  3273. *
  3274.           LEA.L     -ERR_STAT(A5),A1
  3275.           LEA.L     -CHAR(A5),A0
  3276.           MOVE.L    #GET_CHAR,D1
  3277.           TRAP      #1
  3278.           MOVE.L    (A1),D7
  3279.           BNE.S     ERROR               IF D7 = 0, THEN NO ERROR
  3280. *
  3281. *  You have no errors, great!  Now fetch the character:
  3282. *
  3283.           MOVE.L    (A0),DX             DX = CHARACTER.
  3284.           UNLK      A6
  3285.           RTS
  3286. ERROR     EQU       $
  3287.  
  3288.  
  3289.  
  3290.  
  3291.  
  3292.  
  3293.  
  3294.  
  3295. Copyright (C) 1986, 1987 by Creative Software Technology      2-25
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301. Advance Operating System                                Chapter 2
  3302.  
  3303.  
  3304. NAME:  trn_stat1
  3305.  
  3306. DESCRIPTION:
  3307.  
  3308.      See  if  the  transmit buffer in the default i/o  device  is 
  3309. ready to transmit a character.   The user-supplied device  driver 
  3310. must  set  the  carry bit in the condition code register  if  the 
  3311. transmit register is ready to transmit,  and clear the carry  bit 
  3312. if  the  transmit register is not ready to transmit a  character.  
  3313. User-supplied device driver must preserve registers A6 and A7.
  3314.  
  3315. ENTRY CONDITIONS:   User Mode only.
  3316.  
  3317. TYPICAL USAGE:
  3318.  
  3319.      trn_stat1 ( &err_stat, &dev_stat );
  3320.      
  3321. ASSEMBLY INTERFACE:
  3322.  
  3323.           LINK      A5,#-PARM_TABLE
  3324. NO_TRN    LEA.L     -ERR_STAT(A5),A1    TEL AOS/68K WHERE TO PUT
  3325.           LEA.L     -DEV_STAT(A5),A0    ER STAT AND DEVICE STAT.
  3326.           MOVE.L    #TRN_STAT1,D0       (TRN_STAT1 EQU $0000001B)
  3327.           TRAP      #1                  FORMAL AOS/68K CALL.
  3328.           MOVE.L    (A1),D1             IF A1 POINTS TO TO A NON-
  3329.           BNE.S     $                   ZERO VALUE, NO EXIT.
  3330.           MOVE.L    (A0),D1             NOW GET DEVICE STATUS.
  3331.           BEQ.S     NO_TRN              JMP IF TRANS BUF NOT RDY.
  3332.  
  3333. PARAMETERS:
  3334.  
  3335.      D0 = command long word;  A0 = the address where you want the 
  3336. status ( of the default i/o port) to be placed.
  3337.  
  3338. REGISTERS CHANGED:  None.
  3339.  
  3340. CAVEATS:
  3341.  
  3342.      If the system designer does not set up the "SERVPTR" parame-
  3343. ter  "trn_stat1" properly just behind the key_stat  vector,  then 
  3344. ADVANCE  will  not attempt to call  the  trn_stat1  routine.   If 
  3345. SERVPTR  is set to some non-zero value,  and the fourth long word 
  3346. in  the SERVPTR table (the table that SERVPTR points to) is  non-
  3347. zero,  it should be a pointer to trn_stat1.
  3348.  
  3349. RETURN VALUES:
  3350.  
  3351.      The long word that A1 points to will be equal to either a:
  3352.        Zero     = no problems.
  3353.        Non-zero = no key_stat1 vector was found by AOS/68K
  3354.  
  3355.      The long word that A0 points to will be equal to either a:
  3356.        Zero     = transmit register is not ready
  3357.        Non-zero = transmit register is ready to transmit a char.
  3358.  
  3359.  
  3360.  
  3361. Copyright (C) 1986, 1987 by Creative Software Technology      2-26
  3362.  
  3363.  
  3364.  
  3365.  
  3366.  
  3367. Advance Operating System                                Chapter 2
  3368.  
  3369.  
  3370. NAME:  gt_cpt
  3371.  
  3372. DESCRIPTION:
  3373.  
  3374.      Get a pointer to the configuration table.   Address register 
  3375. A0  contains a pointer to a memory location that contains a  copy 
  3376. of the configuration table pointer.
  3377.  
  3378. ASSEMBLY INTERFACE:
  3379.  
  3380.      MOVE.L    #GT_CPT,D0
  3381.      TRAP      #1
  3382.      MOVE.L    (A0),D1        D1 NOW EQUALS ADDRESS OF CONFIG TBL
  3383.  
  3384. PARAMETERS:
  3385.  
  3386.      D0 = command long word;  A0 = the address where you want the 
  3387. address of the configuration table.
  3388.  
  3389. REGISTERS CHANGED:  None.
  3390.  
  3391. CAVEATS:  No special error trapping available.
  3392.  
  3393.      
  3394.  
  3395. NAME:  g_stk
  3396.  
  3397. DESCRIPTION:
  3398.  
  3399.      Get a pointer to the value of the system stack pointer.
  3400.  
  3401. ASSEMBLY INTERFACE:
  3402.  
  3403.      MOVE.L    #G_STK,D0
  3404.      TRAP      #1
  3405.      MOVE.L    (A0),D3        D3 = VALUE OF SYSTEM STACK POINTER
  3406.  
  3407. PARAMETERS:
  3408.  
  3409.      D0 = command long word;  A0 = the address where you want the 
  3410. value of the system stack pointer.
  3411.  
  3412. REGISTERS CHANGED:  None.
  3413.  
  3414. CAVEATS:  No special error trapping available.
  3415.  
  3416.  
  3417.  
  3418.  
  3419.  
  3420.  
  3421.  
  3422.  
  3423.  
  3424.  
  3425.  
  3426.  
  3427. Copyright (C) 1986, 1987 by Creative Software Technology      2-27
  3428.  
  3429.  
  3430.  
  3431.  
  3432.  
  3433. Advance Operating System                                Chapter 2
  3434.  
  3435.  
  3436. NAME:  res_tsk
  3437.  
  3438. DESCRIPTION:
  3439.  
  3440.      This  command resets a task back to some initial  condition.  
  3441. The  calling  program must know what the "reset" registers  were.  
  3442. There are two ways to do this.   The first way is to not have the 
  3443. task turned on initially by AOS/68K.  You can then get the system 
  3444. stack  pointer and the other two registers by looking at the  REG 
  3445. dump.   The  other way is to write a macro that would first  save 
  3446. the PC,  and then the other registers of the "reset" location.  A 
  3447. diagnostic program can then get them,  turn off the target  task,  
  3448. and send the saved registers to the res_tsk routine.
  3449.  
  3450. ENTRY CONDITIONS:   User Mode only.
  3451.  
  3452. TYPICAL USAGE:
  3453.  
  3454.      res_tsk ( &status, ¶meters );
  3455.      
  3456. ASSEMBLY INTERFACE:
  3457.  
  3458.      LINK      A5,#-PARMS         A0 -> Task ID of target task
  3459.      LEA.L     -REGS(A5),A0             New PC
  3460.      LEA.L     -STAT(A5),A1             User stack pointer
  3461.      MOVE.L    #RES_TSK,D0              System stack pointer
  3462.      TRAP      #1
  3463.  
  3464. PARAMETERS:
  3465.  
  3466.      D0 = command long word. A0 = pointer to list of 4 long words 
  3467. that  contain in the following order:  1) task id of the task  to 
  3468. reset, 2) new PC, 3) user stack ptr, and 4) system stack ptr.  If 
  3469. the task ID that A0 points to is at location $1000,  then the new 
  3470. PC long word would be located at $1004,  user stack pointer would 
  3471. be located at $1008, and the system stack pointer at $100C.
  3472.  
  3473. REGISTERS CHANGED:  none.
  3474.  
  3475. CAVEATS:
  3476.  
  3477.      If the task you want to reset is not inactive,  it will  not 
  3478. get reset.   Also,  there is no error trapping.  If you forget to 
  3479. load whatever A0 is pointing to with valid data, then your compu-
  3480. ter system may boldly go where no computer has gone before.
  3481.  
  3482. RETURN VALUES:
  3483.  
  3484.      The long word that A1 points to will have one of these codes 
  3485. (right justified within the long word) upon return from res_tsk:
  3486.  
  3487.      00       = task was reset O.K.
  3488.      01 - 04  = "tsk_on" error codes (these should never happen).
  3489.      05       = task id you send is not an inactive task.
  3490.  
  3491.  
  3492.  
  3493. Copyright (C) 1986, 1987 by Creative Software Technology      2-28
  3494.  
  3495.  
  3496.  
  3497.  
  3498.  
  3499.  
  3500.  
  3501.  
  3502.  
  3503.  
  3504. 3.0  ADVANCE OPERATING SYSTEM CALLS (Part Two)
  3505.  
  3506.      The  calls  in chapter two are to be added to  the  existing 
  3507. commands  in chapter 1.   Some of the following calls may already 
  3508. be  released.   They are in this separate chapter because at  the 
  3509. time  of  the release of this version of the manual  the  Chapter 
  3510. three calls were not out of beta test site.  All AOS system calls 
  3511. require  a minimum of 500 hours of run time in a variety of  test 
  3512. conditions.   AOS calls are randomly executed in regression  test 
  3513. conditions  to check for many types of run time  problems.   Here 
  3514. are some of the new AOS calls ready or nearly ready for release:
  3515.  
  3516. NAME:  fetch_mem
  3517.  
  3518. DESCRIPTION:
  3519.  
  3520.      System call fetch_mem fetches 2K blocks of ram per call.   A 
  3521. pointer is returned to the caller pointing to the newly allocated 
  3522. memory area.
  3523.  
  3524. TYPICAL USAGE:  memory_pointer = fetch_mem ();
  3525.  
  3526. ENTRY CONDITIONS:  User Mode or System Mode
  3527.  
  3528. ASSEMBLY INTERFACE:
  3529.  
  3530.      LINK      A6,#PARAMETER_TABLE
  3531.      LEA.L     -STATUS(A6),A1
  3532.      LEA.L     -POINTER(A6),A0
  3533.      MOVE.L    #FETCH,D0
  3534.      TRAP      #1
  3535.  
  3536. PARAMETERS:
  3537.  
  3538.      D0  = command long word;  A1 = address of STATUS;  and A0 is 
  3539. where you want to put the pointer to ram.
  3540.  
  3541. REGISTERS CHANGED: none.
  3542.  
  3543. CAVEATS:  none.
  3544.  
  3545. RETURN VALUES:
  3546.  
  3547.      Parameter  STATUS  is  reset  to 0 if a  call  to  fetch  is 
  3548. successful  and A0 points to the newly allocated 2K memory  area. 
  3549. Otherwise, STATUS is set to the following error condition:
  3550.  
  3551.      $01 : There is not enough ram in the ram pool.
  3552.  
  3553.  
  3554.  
  3555.  
  3556.  
  3557.  
  3558.  
  3559. Copyright (C) 1986, 1987 by Creative Software Technology      3-1
  3560.  
  3561.  
  3562.  
  3563.  
  3564.  
  3565. Advance Operating System Calls (Part Two)               Chapter 3
  3566.  
  3567.  
  3568. NAME:  release_mem
  3569.  
  3570. DESCRIPTION:
  3571.  
  3572.      System  call  release_mem releases 2K blocks of memory  back 
  3573. into the ram pool.
  3574.  
  3575. ENTRY CONDITIONS:  User Mode or System Mode
  3576.  
  3577. TYPICAL USAGE:  release_mem (pointer_to_2k_memory);
  3578.  
  3579. ASSEMBLY INTERFACE:
  3580.  
  3581.      LINK      A6,#PARAMETER_TABLE
  3582.      LEA.L     -STATUS(A6),A1
  3583.      MOVE.L    #RELEASE,D0
  3584.      TRAP      #1
  3585.  
  3586. PARAMETERS:  none
  3587.  
  3588. REGISTERS CHANGED:  none.
  3589.  
  3590. CAVEATS:
  3591.  
  3592.      The  area  that  you  are returning to  ADVANCE  should  not 
  3593. contain important parameters of any kind,  as it will very likely 
  3594. be reassigned to the next task that makes a request for ram.
  3595.  
  3596. RETURN VALUES:  none.
  3597.  
  3598.  
  3599.  
  3600.  
  3601.  
  3602.  
  3603.  
  3604.  
  3605.  
  3606.  
  3607.  
  3608.  
  3609.  
  3610.  
  3611.  
  3612.  
  3613.  
  3614.  
  3615.  
  3616.  
  3617.  
  3618.  
  3619.  
  3620.  
  3621.  
  3622.  
  3623.  
  3624.  
  3625. Copyright (C) 1986, 1987 by Creative Software Technology      3-2
  3626.  
  3627.  
  3628.  
  3629.  
  3630.  
  3631. Advance Operating System Calls (Part Two)               Chapter 3
  3632.  
  3633.  
  3634. NAME: free_mem
  3635.  
  3636. DESCRIPTION:
  3637.  
  3638.      This  system call returns the number of 2K blocks of  memory 
  3639. available in the ram pool.
  3640.  
  3641. ENTRY CONDITIONS:  User Mode or System Mode
  3642.  
  3643. TYPICAL USAGE:  siz_mem = free_mem ();
  3644.  
  3645. ASSEMBLY INTERFACE:
  3646.  
  3647.      LINK      A6,#PARAMETER_TABLE
  3648.      LEA.L     -STATUS(A6),A1
  3649.      LEA.L     -SIZE(A6),A0
  3650.      MOVE.L    #FRE_MEM,D0
  3651.      TRAP      #1
  3652.  
  3653. PARAMETERS:
  3654.  
  3655.      D0 = command long word;  A1 = address of STATUS;  and A0  is 
  3656. a  pointer  to where you want to ADVANCE to put the number of  2K 
  3657. blocks of memory available.
  3658.  
  3659. REGISTERS CHANGED:  none.
  3660.  
  3661. CAVEATS:  none.
  3662.  
  3663. RETURN VALUES:
  3664.  
  3665.      A0  points  to  a location that contains the  number  of  2K 
  3666. blocks of memory that are still available in the RAM POOL.
  3667.  
  3668.  
  3669.  
  3670.  
  3671.  
  3672.  
  3673.  
  3674.  
  3675.  
  3676.  
  3677.  
  3678.  
  3679.  
  3680.  
  3681.  
  3682.  
  3683.  
  3684.  
  3685.  
  3686.  
  3687.  
  3688.  
  3689.  
  3690.  
  3691. Copyright (C) 1986, 1987 by Creative Software Technology      3-3
  3692.  
  3693.  
  3694.  
  3695.  
  3696.  
  3697. Advance Operating System Calls (Part Two)               Chapter 3
  3698.  
  3699.  
  3700. NAME:  edc_system
  3701.  
  3702. DESCRIPTION:
  3703.  
  3704.      This  call  sets the system state table for edc  processing.  
  3705. Ones and zeros in the 32-bit state table are used by the  control 
  3706. module  to process error detection and correction.   Modules each 
  3707. make  an  edc_state() system call as to update to  machine  state 
  3708. whenever  a  significant change of state has  occurred  in  their 
  3709. processing sphere of influence.
  3710.  
  3711. TYPICAL USAGE:  edc_system ( state );
  3712.  
  3713. ASSEMBLY INTERFACE:
  3714.  
  3715.      LINK      A6,#PARAMETER_TABLE
  3716.      LEA.L     -STATUS(A6),A1
  3717.      MOVE.L    #EDCS,D0
  3718.      MOVE.L    #EDC_STATE,D1
  3719.      TRAP      #1
  3720.  
  3721. PARAMETERS:  none.
  3722.  
  3723. REGISTERS CHANGED:  none.
  3724.  
  3725. CAVEATS:  none.
  3726.  
  3727. RETURN VALUES:  none.
  3728.  
  3729.  
  3730.  
  3731.  
  3732.  
  3733.  
  3734.  
  3735.  
  3736.  
  3737.  
  3738.  
  3739.  
  3740.  
  3741.  
  3742.  
  3743.  
  3744.  
  3745.  
  3746.  
  3747.  
  3748.  
  3749.  
  3750.  
  3751.  
  3752.  
  3753.  
  3754.  
  3755.  
  3756.  
  3757. Copyright (C) 1986, 1987 by Creative Software Technology      3-4
  3758.  
  3759.  
  3760.  
  3761.  
  3762.  
  3763. Advance Operating System Calls (Part Two)               Chapter 3
  3764.  
  3765.  
  3766. NAME:  edc_task
  3767.  
  3768. DESCRIPTION:
  3769.  
  3770.      This  is how a task communicates the low-level bit state  of 
  3771. each task.   As the task state changes dynamically, this informa-
  3772. tion is sent to the control module,  via an ADVANCE system  algo-
  3773. rithm.   The control module (included with the EDC package) keeps 
  3774. an active record of the state of each task.   This information is 
  3775. compared  against the system state to see how many times a  slave 
  3776. task  can attempt to correct his local errors.   This information 
  3777. is also used to see if a downstream process can continue, dispite 
  3778. the local error condition.
  3779.  
  3780. TYPICAL USAGE:  edc_task ( task_state, &stat );
  3781.  
  3782. ASSEMBLY INTERFACE:
  3783.  
  3784.      LINK      A6,#PARAMETER_TABLE
  3785.      LEA.L     -STATUS(A6),A1
  3786.      MOVE.L    #EDC_TSK,D0
  3787.      MOVE.L    #STATE,D1
  3788.      TRAP      #1
  3789.  
  3790. PARAMETERS:  none.
  3791.  
  3792. REGISTERS CHANGED:  none.
  3793.  
  3794. CAVEATS:  none.
  3795.  
  3796. RETURN VALUES:  none.
  3797.  
  3798.  
  3799.  
  3800.  
  3801.  
  3802.  
  3803.  
  3804.  
  3805.  
  3806.  
  3807.  
  3808.  
  3809.  
  3810.  
  3811.  
  3812.  
  3813.  
  3814.  
  3815.  
  3816.  
  3817.  
  3818.  
  3819.  
  3820.  
  3821.  
  3822.  
  3823. Copyright (C) 1986, 1987 by Creative Software Technology      3-5
  3824.  
  3825.  
  3826.  
  3827.  
  3828.  
  3829.  
  3830.  
  3831.  
  3832.  
  3833.  
  3834. 4.0  CHAPTER FOUR - ERROR RECOVERY INTERFACE SOFTWARE
  3835.  
  3836.      The  Error Recovery Interface software is included in Part 2 
  3837. of the ADVANCE OPERATING SYSTEM,  and is sold separately.   Addi-
  3838. tional  information is available by requesting the  complete  ERI 
  3839. manual  from  your  local  ADVANCE salesman  or  by   writing  to 
  3840. Creative Software Technology Inc.  A general overview is provided 
  3841. here  so  that engineers can glimpse into the theory  behind  the 
  3842. fault  tolerant aspect of the ADVANCE OPERATING  SYSTEM. 
  3843.  
  3844. Note:   Please  wait  for  the complete ERI Fault  Tolerant  User 
  3845. Manual  before  you  set up data structures  for  error  recovery 
  3846. algorithms.
  3847.  
  3848.      Real-time,  multitasking operating systems with the software 
  3849. to  detect  and  correct errors are more efficient  than  similar 
  3850. systems without error recovery mechanisms.  Concurrent processing 
  3851. features  work  together  with error recovery to  to  smooth  out 
  3852. erratic process variables.  These two features, combined with the 
  3853. AOS Balanced System design,  mean much less down-time and more of 
  3854. the  benefits associated with economical machine operation  (such 
  3855. as scheduling small errors into a more timely preventative  main-
  3856. tenance schedule).   Combinations of asynchronous errors that can 
  3857. not  be  planned for are methodically corrected  (usually  trans-
  3858. parent to the machine operator) one at a time - fault tolerance.
  3859.  
  3860.      The  optional Error Recovery (ERI) Interface to the  ADVANCE 
  3861. Operating  System is very powerful.   Figure 4-1 illustrates  how 
  3862. this  feature works.   The control module (included with the  ERI 
  3863. software)  receives a command from some external source to  start 
  3864. the entire "ABC" process.   The control module then tells modules 
  3865. A,  AB,  and  ABC  to return to the places where they  were  last 
  3866. processing when the "STOP" command was issued.
  3867.  
  3868.      In  this illustration a non-fatal error (one that is correc-
  3869. table)  occurs  in process AB1.   There is processed  product  at 
  3870. ABC1,  which  is beyond the influence of the problem  in  process 
  3871. AB1.   By use of a special, user-defined truth table, the control 
  3872. module  determines   that  product at ABC1 can continue  to  ABC2 
  3873. while the problem at AB1 is being corrected.   Product at C1  can 
  3874. continue  to C2,  and so on.   Thus the error does not hinder the 
  3875. throughput of the machine.
  3876.  
  3877.      But  what  happened to the error?   The module in which  the 
  3878. error  occurred tells the control module the  maximum  reasonable 
  3879. number  of  attempts  that should be made to try to  correct  the 
  3880. problem.   An  ERI  subroutine is then  executed  which  attempts 
  3881. correct  the  error.   The  control module keeps a count  of  the 
  3882. number of tries made to correct the error,  while the  unaffected 
  3883. part of the machine continues its normal processing.
  3884.  
  3885.  
  3886.  
  3887.  
  3888.  
  3889. Copyright (C) 1986, 1987 by Creative Software Technology      4-1
  3890.  
  3891.  
  3892.  
  3893.  
  3894.  
  3895. Advance Operating System                                Chapter 4
  3896.  
  3897.  
  3898.  
  3899.      The ERI subrou-                                          
  3900. tine  finally   cor-   - - - - - - - - MODULE "ABC"- - -      
  3901. rects the problem at  :  _________     _____________    :      
  3902. AB1  before reaching  : |         |   |             |   :      
  3903. the  maximum  number  : |  ABC2   |___| PROCESS ABC |   :      
  3904. of tries.   The con-  : |         |   | COMPLETE    |   :     
  3905. trol   module   then  : |_________|   |_____________|   :      
  3906. releases the  module  :      ^         - - - - - - - - -       
  3907. that  was in trouble  :  ____|______  :                        
  3908. to continue on  from  : |           | :           PROCESS      
  3909. wherever it was when  : | SYNC PROC |<---- C2 <---- C1         
  3910. the  error occurred.  : |   ABC1    | :                         
  3911. ERI has allowed con-  : |___________| :                       
  3912. tinuous   processing   - - - ^ - - - -                         
  3913. of  product and  has   - - - | - - - - MODULE "AB" - - - - -   
  3914. prevented an  expen-  :  ____|___     ________     ________  :
  3915. sive  and time-wast-  : |        |   |        |   |        | :
  3916. ing  shutdown.    If  : |  AB4   |<--|  AB3   |<--|  AB2   | : 
  3917. the  ERI  subroutine  : |________|   |________|   |________| : 
  3918. fails  to correct  a   - - - - - - - - - - -          ^      : 
  3919. working     module's                         :  ______|____  : 
  3920. problem  after   the     PROCESS             : |           | : 
  3921. maximum    allowable       B1 -----> B2 ------>| SYNC PROC | : 
  3922. number of tries, the                         : |    AB1    | : 
  3923. control module shuts                         : |___________| : 
  3924. down  the entire ABC                           - - - -^- - -   
  3925. process and notifies   - - - - - - - - MODULE "A"- - -|- - -   
  3926. the operator of  the  :  ___________                  |      : 
  3927. type   of   problem.  : |           |             ____|____  :  
  3928. The  operator  or  a  : |   START   |            |         | : 
  3929. maintenance  techni-  : |  PROCESS  |----------->|   A2    | :
  3930. cian  must then cor-  : |    A1     |            |_________| :
  3931. rect   the    error.  : |___________|                        :  
  3932. Once he corrects the  :                                      : 
  3933. error,    processing   - - - - - - - - - - - - - - - - - - -   
  3934. continues.
  3935.  
  3936.  
  3937.  
  3938.                                Figure 4-1  ERI Illustration
  3939.  
  3940.  
  3941. 4.1 Error Analysis
  3942.  
  3943.      Most controllers have two basic types of errors.   These two 
  3944. types  of  are  either correctable errors  or  fatal  errors.   A 
  3945. correctable  error  is  defined  to  be  an  error  that  can  be 
  3946. corrected in a finite amount of time without stopping the work in 
  3947. progress.   A fatal error is defined to be a rare situation where 
  3948. there  is no certain hope of quick error  recovery.   The  latter 
  3949. type   of  error  causes  an  immediate  shutdown  of  the  local 
  3950. processing associated with the error condition.
  3951.  
  3952.  
  3953.  
  3954.  
  3955. Copyright (C) 1986, 1987 by Creative Software Technology      4-2
  3956.  
  3957.  
  3958.  
  3959.  
  3960.  
  3961. Advance Operating System                                Chapter 4
  3962.  
  3963.  
  3964.      After analyzing various types of supposed fatal error condi-
  3965. tions in many types of process controllers,  it can be found with 
  3966. some  assurance  that  most "fatal" errors are really  not  fatal 
  3967. errors.   Most  present day "fatal" errors are the by-product  of 
  3968. unbalanced multitasking systems.   In an unbalanced  multitasking 
  3969. system,  tasks  are  given  an unequal amount  of  functionality.  
  3970. Unbalanced  systems  are usually not able to achieve  true  fault 
  3971. tolerance.   Since  the Balanced System design was  discussed  in 
  3972. detail  in Chapter One,  it will not be discussed in great detail 
  3973. here.   In  addition  to problems associated with  an  unbalanced 
  3974. system,  programmers  in  many design teams do not  know  from  a 
  3975. system  wide  standpoint how a particular error condition can  be 
  3976. corrected at some point in their program.   Fault tolerance  must 
  3977. be designed in from the beginning, not as an afterthought.
  3978.  
  3979.      The  following graph shows the relative efficiency  elements 
  3980. of  most process control systems with increasing levels of  error 
  3981. detection  and  correction.   The  graph  is  not  drawn  to  any 
  3982. particular scale, nor does it represent test cases from any real-
  3983. time process.  It is reproduced to show the relative positions of 
  3984. the  different  levels  of  fault  tolerance.    Notice  the  big 
  3985. improvement  in  throughput  for just the Level  1  ERI.   Higher 
  3986. levels  of  efficiency are obtainable.   There is a big  jump  in 
  3987. efficiency  from no ERI to Level one ERI.   One obtains a  lesser 
  3988. and lesser efficiency return for each higher level in  ERI.   The 
  3989. curve  represents equal improvements in fault tolerance for  each 
  3990. level  of ERI.   The ordinate axis represents the number of units 
  3991. of  processed  parts,  times  1000  for  example.   The  abscissa 
  3992. represents equal units of time.
  3993.  
  3994.      | - - - - - - - - X  Level 4 ERI
  3995.      |                 |
  3996.   20 | - - - - - - - - - -X  Level 3 ERI
  3997.      |                 |  |
  3998.   15 | - - - - - - - - - - - - X  Level 2 ERI
  3999.      |                 |  |    |
  4000.   10 | - - - - - - - - - - - - - - - - -X  Level 1 ERI
  4001.      |                 |  |    |        |
  4002.    5 | - - - - - - - - - - - - - - - - - - - - - - - - - X
  4003.      |                 |  |    |        |              No ERI
  4004.    0 +-------1--------2+--+----3--------4--------5-------+6
  4005.  
  4006.                            Figure 4-2
  4007.  
  4008. 4.2  Error Correction Word
  4009.  
  4010.      Each  working module has a data table containing pointers to 
  4011. that  module's correction subroutines.   The control module  uses 
  4012. these data tables when correcting errors.  A very efficient error 
  4013. code substructure links all ERI processing together.  When a task 
  4014. had  an error,  the task sends a message to the  control  module.  
  4015. The message is a pointer to the error correction word.  The error 
  4016. word  tells  the Control Module everything necessary in order  to 
  4017. try  to clear the entering task's error record.
  4018.  
  4019.  
  4020.  
  4021. Copyright (C) 1986, 1987 by Creative Software Technology      4-3
  4022.  
  4023.  
  4024.  
  4025.  
  4026.  
  4027. Advance Operating System                                Chapter 4
  4028.  
  4029.  
  4030.      Here is a "C" language template for the various terms in the 
  4031. ERI word, to see the scope of the data elements:
  4032.  
  4033. struct    ERI_WORD_MODE_0
  4034. {         unsigned
  4035.           fatal_bit_m0             : 1, /* 1 = not correctable */
  4036.           error_source_m0          : 3, /* source of the error */
  4037.           error_mode_m0            : 1, /* error mode          */
  4038.           error_level_m0           : 3, /* task error state    */
  4039.           error_index_m0           : 4, /* main error index    */
  4040.           forever_bit_m0           : 1, /* 1 = correct forever */
  4041.           numb_of_tries_m0         : 7, /* # tries to correct  */
  4042.           reserved_m0              : 8; /* reserved byte       */
  4043. };
  4044.  
  4045. struct    ERI_WORD_MODE_0
  4046. {         unsigned
  4047.           fatal_bit_m1             : 1, /* 1 = not correctable */
  4048.           error_source_m1          : 3, /* source of the error */
  4049.           error_mode_m1            : 1, /* error mode          */
  4050.           error_level_m1           : 3, /* task error state    */
  4051.           error_index_m1           : 4, /* main error index    */
  4052.           alt_error_index_m1       : 4, /* alternate error idx */
  4053.           number_of_tries_m1       : 4, /* # tries to correct  */
  4054.           alternate_tries_m1       : 4, /* alternate # tries   */
  4055.           reserved_m1              : 8; /* reserved byte       */
  4056. };
  4057.  
  4058. 4.2.1     General Description
  4059.  
  4060. 4.2.1.1   Correctable or Non-correctable
  4061.  
  4062.      The  most significant bit of information (bit31)  tells  the 
  4063. Control Module if the error is correctable or fatal.   If the bit 
  4064. is  set  to  TRUE then the errant module never returns  from  the 
  4065. Error_to_Control  subroutine.   No error recovery techniques  are 
  4066. started.    This   situration  eventually  causes  the   upstream 
  4067. processing, or system operator, to do some form of system reset.
  4068.  
  4069.  
  4070. 4.2.1.2   Error Source Field
  4071.  
  4072.      The next three bits (bits 30,  29, and 28) tells the Control 
  4073. Module  the  source of the error.   These three  bits  allow  for 
  4074. reporting seven major sources of errors.
  4075.  
  4076.  
  4077. 4.2.1.3   Error Mode
  4078.  
  4079.      In  cases where this bit is set to TRUE,  some of the  error 
  4080. bytes  are  sub-divided to do a certain type of conditional  case 
  4081. statement.   If TRUE, the Error Correction Word is sub-divided to 
  4082. handle cases where the following situation happens:   Try to  fix 
  4083.  
  4084.  
  4085.  
  4086.  
  4087. Copyright (C) 1986, 1987 by Creative Software Technology      4-4
  4088.  
  4089.  
  4090.  
  4091.  
  4092.  
  4093. Advance Operating System                                Chapter 4
  4094.  
  4095.  
  4096. this  situation  by doing some algorithm X number of  times.   If 
  4097. this does not correct the situation then do some other  algorithm 
  4098. Y  number of times.   If that does not work then do whatever  you 
  4099. normally do as described in the Error State (described next).
  4100.  
  4101.  
  4102. 4.2.1.4   Error State
  4103.  
  4104.      The  next three bits are very interesting.   Tasks are given 
  4105. the  ability to tell the ERI task just how many times to  try  to 
  4106. correct  the error.   If after the maximum number of attempts  to 
  4107. correct  the error,  and the error is not corrected,  the Control 
  4108. Module looks at the Error State bits (bits 26, 25, and 24) to see 
  4109. what  the final state of the error is to become.   An error  that 
  4110. was thought to be correctable may now become "fatal."
  4111.  
  4112.  
  4113. 4.2.1.4.1 Error State Four
  4114.  
  4115.      The "100" Error State is a request (after the maximum  error 
  4116. tries) for a system soft stop.  The calling task wants to get the 
  4117. attention  of  the operator by sending a warning message of  some 
  4118. type.   This  error  state also permits the logging  of  critical 
  4119. warning  information  if required.   If expedient to  do  so  the 
  4120. Control  Module  will stop the process at a convenient  time  and 
  4121. send  the message,  etc.   If the operator or controlling process 
  4122. sends  a restart command of some type,  the process is  restarted 
  4123. and  the  Control  Module  error base for  the  calling  task  is 
  4124. cleared.   The calling task is returned to the place in his  code 
  4125. just past the call to the error_to_control call.  The whole "100" 
  4126. error process is usually called a "casual message" request.   Use 
  4127. error  state  four  when the sensor or whatever  needs  cleaning, 
  4128. there  is too much noise in the logic supply  line,  it's  coffee 
  4129. time, etc.
  4130.  
  4131.  
  4132. 4.2.1.4.2 Error State Three
  4133.  
  4134.      The "011" Error State forces the system (after max tries) to 
  4135. soft  stop.   The calling task has something so important to  get 
  4136. accross  to the operator that it cannot possibly wait any longer.  
  4137. Not only will the system soft stop, but a warning message will be 
  4138. sent and the warning condition will be logged if necessary.  This 
  4139. condition is still non-fatal, however.  Once the machine operator 
  4140. presses the "RUN" switch the Control Module clears the error base 
  4141. for  the  calling  module.   And again,  the  calling  module  is 
  4142. returned  to  the  place in its code just past the  call  to  the 
  4143. error_to_control call.   Use this error state whenever  something 
  4144. potentially  dangerous might happen if the warning message is not 
  4145. heeded, etc.
  4146.  
  4147.  
  4148.  
  4149.  
  4150.  
  4151.  
  4152.  
  4153. Copyright (C) 1986, 1987 by Creative Software Technology      4-5
  4154.  
  4155.  
  4156.  
  4157.  
  4158.  
  4159. Advance Operating System                                Chapter 4
  4160.  
  4161.  
  4162. 4.2.2.1.4.3    Error State Two
  4163.  
  4164.      The  "010"  Error State is a serious  error  condition.   If 
  4165. after maximum number of error correction attempts the ERI has not 
  4166. corrected  the error,  Error State Two now instructs the  Control 
  4167. Module  that the calling task has caused a serious system  fault.  
  4168. The calling task is not returned to its code.   The process comes 
  4169. to  an immediate soft stop,  logs the error and sends the  errant 
  4170. task's  message  to the operator and/or upstream  controller.   A 
  4171. system  re-start  is  required to reset  the  errant  task.   The 
  4172. unusual feature of Error State Two is that the other modules  are 
  4173. not  directly  affected.   Only the errant module is  shut  down.  
  4174. Many  times in real-world error conditions a process can carry on 
  4175. without some important function for a short time.    If the  rest 
  4176. of  the tasks cannot carry on without the missing task,  then the 
  4177. process will not run.   If they can run,  then fine.   The  other 
  4178. tasks run as soon as the operator presses the start switch again.  
  4179. The operator (test engineer, upstream controller, etc) starts the 
  4180. process again on local authority.  This situation is not always a 
  4181. fatal error condition.
  4182.  
  4183.      To  give a more clear example of the use of Error State  Two 
  4184. take  into condition the following situation.   Suppose that  you 
  4185. have  a task that computes the checksum of all eprom data.   Also 
  4186. suppose that it runs at an average priority level as all tasks do 
  4187. the the AOS Balanced System design.   If for any reason you  swap 
  4188. out  a  table,  change a byte of data,  or in any way change  the 
  4189. effective  checksum of current eprom data,  you will  immediately 
  4190. cause the checksum task to halt the whole system (if the checksum 
  4191. task is allowed to run).  The checksum task is therefore given an 
  4192. error recovery routine that sets the Error State Two condition to 
  4193. TRUE  if  ERI fails to correct the problem in a short  amount  of 
  4194. time.  The system could run without the checksum task.
  4195.  
  4196.  
  4197. 4.2.1.4.4 Error State One
  4198.  
  4199.      Error  State  One  "001" is one of the  most  serious  error 
  4200. states.   If  after the maximum number of attempts to correct the 
  4201. error  and the ERI does not correct the incomming  task's  error, 
  4202. then  the  system  does a hard stop.   Some major error  has  now 
  4203. occurred (not a loss of power,  however) and the calling task  is 
  4204. not  released  from the error_to_control routine.   None  of  the 
  4205. other  system tasks are supposed to be able to  function,  theor-
  4206. etically.   A  system  re-start (or reset) is necessary  to  make 
  4207. everyting work again.  Use this error state cautiously.
  4208.  
  4209.  
  4210.  
  4211.  
  4212.  
  4213.  
  4214.  
  4215.  
  4216.  
  4217.  
  4218.  
  4219. Copyright (C) 1986, 1987 by Creative Software Technology      4-6
  4220.  
  4221.  
  4222.  
  4223.  
  4224.  
  4225. Advance Operating System                                Chapter 4
  4226.  
  4227.  
  4228. 4.2.2     Error Correction Index Code
  4229.  
  4230.      This byte (bits 23,  22, 21, 20, 19, 18, 17, and 16) is used 
  4231. as an index into an error correction table.  Each task has a data 
  4232. control  block  that  directs  the ERI routine  into  the  proper 
  4233. correction algorithm.   This structure is a table of pointers  to 
  4234. self-contained,  error  correction algorithms for that particular 
  4235. task.   In mode 1,  however,  the error correction index code  is 
  4236. broken down into two,  four bit indices.   Error mode 1, however, 
  4237. is  more  powerful as it instructs the Control Module to  try  to 
  4238. correct  the  error  one way first,  and if the  problem  is  not 
  4239. corrected then try to fix the error the other way.
  4240.  
  4241. 4.2.3     Number of Tries
  4242.  
  4243.      This  is  the  calling tasks key to how many times  the  ERI 
  4244. routine will attempt to correct the reported error condition.  In 
  4245. mode 0,  for instance, you can have up to 127 attempts to correct 
  4246. an error condition.   If this byte is negative (bit 15 = 1)  then 
  4247. this instructs the ERI routine, and thusly the Control Module, to 
  4248. try  to fix the error as many times as is expedient to do so from 
  4249. a system point of view.  The calling task is not required to know 
  4250. all  the various states that the other tasks are in to make  this 
  4251. decision.   On the Control Module knows the overall state of  the 
  4252. system.   In mode 1 this field represents two four bit quantities 
  4253. (with no negative bit,  or fix forever algorithm).  The Number of 
  4254. Tries byte represents bits 16,  17, 18, 19, 20, 21, 22, and 23 in 
  4255. the Error Correction Word.
  4256.  
  4257.  
  4258.  
  4259.  
  4260.  
  4261.  
  4262.  
  4263.  
  4264.  
  4265.  
  4266.  
  4267.  
  4268.  
  4269.  
  4270.  
  4271.  
  4272.  
  4273.  
  4274.  
  4275.  
  4276.  
  4277.  
  4278.  
  4279.  
  4280.  
  4281.  
  4282.  
  4283.  
  4284.  
  4285. Copyright (C) 1986, 1987 by Creative Software Technology      4-7
  4286.  
  4287.  
  4288.  
  4289.  
  4290.  
  4291.  
  4292.  
  4293.  
  4294.  
  4295.  
  4296. 5.0  CHAPTER FIVE - INTERACTIVE DIAGNOSTIC MODULE (IDM)
  4297.  
  4298.      The  Interactive  Diagnostic  Module is sold as  a  8K  byte 
  4299. EPROM  (or available on a MS-DOS formatted disk as a Motorola S19 
  4300. record).   The IDM is position independent and can operate almost 
  4301. anywhere in the 68K memory map,  except over the exception  table 
  4302. vectors,  etc.   The standard AOS configuration table governs the 
  4303. way the user registers the IDM with AOS.  The Task Number for the 
  4304. IDM  has to be the ASCII characters "ID" ($4944).   The amount of 
  4305. stack needed for the IDM is 2K bytes.   The "PCTR" vector is  the 
  4306. beginning  address  of wherever you decide to locate the  IDM  in 
  4307. your 68K memory map.
  4308.  
  4309.      The  optional  IDM created for the ADVANCE Operating  System 
  4310. is also called the debug module.   This module runs  concurrently 
  4311. with the application layer,  for two major reasons.   First,  the 
  4312. programmer  can get an "inside view" of the software as it  runs.  
  4313. Second,  the  module can overcome the basic deficiencies of  most 
  4314. logic analyzers.   Logic analyzers cannot trap just one module or 
  4315. "task" in a multitasking system without halting the whole system.  
  4316. The  ADVANCE background diagnostics can selectively trap just one 
  4317. task.   The other tasks continue to run unaffected.  Logic analy-
  4318. zers  also usually have to halt the system in order for the  pro-
  4319. grammer to modify code.  The ADVANCE debug module can modify code 
  4320. without  halting the system.   Also,  the debug module  can  trap 
  4321. intermittent  errors  without the machine being taken  apart  for 
  4322. examination and without the use of logic cables.
  4323.  
  4324.      The  background  diagnostics include  an  easy-to-use  hexa-
  4325. decimal editor.  This utility permits interactive examination and 
  4326. modification  of application layer code or parameter  data.   The 
  4327. hex  editor can also "block-move" data and independently  execute 
  4328. program subroutines.   Whenever application code is in RAM,  pro-
  4329. grammers can easily locate and change conditional branch errors.
  4330.  
  4331.      In addition, the debug module allows breakpoints, a powerful 
  4332. tool in multitasking situations.   A programmer can interactively 
  4333. capture  or stop the first module to hit a break point.   He  can 
  4334. examine  and modify the module's registers as necessary.   He can 
  4335. even  change its program counter so that the module returns to  a 
  4336. location different from the one it came from.  Breakpoints do not 
  4337. directly  affect  the other modules.   They  "capture"  only  the 
  4338. module that hits one of them.  The other modules continue to run.  
  4339. Hitting  a  breakpoint,   of  course,  temporarily  prevents  the 
  4340. captured  module  from executing any code beyond the  breakpoint.  
  4341.  
  4342.      There are many other useful features included in the ADVANCE 
  4343. Operating  System diagnostics.   Of the remaining features,  how-
  4344. ever,  the "link" is the most powerful (The Link software may  or 
  4345. may  not  be ready at the time this manual is released  - if  you 
  4346. need  this command,  then check with CST before you order the IDM 
  4347.  
  4348.  
  4349.  
  4350.  
  4351. Copyright (C) 1986, 1987 by Creative Software Technology,     5-1
  4352.  
  4353.  
  4354.  
  4355.  
  4356.  
  4357. Advance Operating System                                Chapter 5
  4358.  
  4359.  
  4360. to  make sure this command is ready).   This diagnostic lets  the 
  4361. programmer  link  the  terminal connected to  the  target  system 
  4362. through to the development station  (See Fig.  5-1).   The target 
  4363. system  then becomes transparent.   The programmer may work  with 
  4364. the  target  system  or the development  station  from  the  same 
  4365. terminal.
  4366.  
  4367.      This link is available whether or not the application  layer 
  4368. is  running.   Because the linking feature operates in the  back-
  4369. ground, the application layer runs real-time and unaffected.  The 
  4370. link  software (which is contained in the debug module) uses only 
  4371. a small slice of processor time.
  4372.  
  4373.  
  4374.  _____    ___________________________________________________ 
  4375. |     |  |                                                   |
  4376. | BUS |--|I/O PORT                      SLAVE CPU 3          |
  4377. |     |  |___________________________________________________|
  4378. |     |  |                                                   |
  4379. | BUS |--|I/O PORT                      SLAVE CPU 2          |
  4380. |     |  |___________________________________________________|
  4381. |     |           ________                  ___________       
  4382. |     |   _______|        |________________|           |_____
  4383. | HOST|  |       | MOTORS |     SLAVE      | SOLENOIDS |     |
  4384. | CPU |  |       |________|     CPU 1      |___________|     |
  4385. |     |  |         |                                 |       |
  4386. |     |  |         |_____      AOS/68K       ________|       |
  4387. |     |  |               |                  |        ________|__
  4388. |     |  |            TASK 1------------TASK 2      |           |
  4389. |     |  |               |                  |      -| SENSORS   |
  4390. | BUS |--|I/O PORT---CONTROL            TASK 3----| |___________|
  4391. |     |  |               |                  |     | |           |
  4392. |_____|  |                ------- IDM ------       -|CONTROLLERS|
  4393.          |         ________       | |        ______ |___________|
  4394.          |        |        |      | |       |      |         |
  4395.          |        |I/O PORT|------   -------|RS-232|         |
  4396.          |________|________|________________|______|_________|
  4397.                       |                        |
  4398.              _________|___________         ____|_____
  4399.             |      I/O PORT       |       |  RS-232  |
  4400.             |                     |       |          |
  4401.             |                     |       |          |
  4402.             | DEVELOPMENT STATION |       | TERMINAL |
  4403.             |_____________________|       |__________|
  4404.  
  4405.  
  4406.  
  4407.                            Figure 5-1
  4408.                      Typical IDM Application
  4409.  
  4410.  
  4411.  
  4412.  
  4413.  
  4414.  
  4415.  
  4416.  
  4417. Copyright (C) 1986, 1987 by Creative Software Technology,     5-2
  4418.  
  4419.  
  4420.  
  4421.  
  4422.  
  4423. Advance Operating System                                Chapter 5
  4424.  
  4425.  
  4426. 5.1  IDM Command Parser
  4427.  
  4428.      The  IDM uses a simple command parser to extract information 
  4429. from the command line.  There are several special characters that 
  4430. can be used to control user input:
  4431.  
  4432.      CTRL-H         backspace one character.
  4433.      CTRL-X         go to beginning of command string.
  4434.      CTRL-Z         redisplay cmd line till CR character found.
  4435.      CTRL-C         redisplay cmd line till CR character found.
  4436.      CR             enter the command line into the parser.
  4437.  
  4438. If a valid command line is present from a former command, and the 
  4439. user wants to run the same command again, just entering a CR will 
  4440. execute the last command line.   This feature is very useful, for 
  4441. example,  when you want to view a section of memory over and over 
  4442. again by just hitting the <CR> key.
  4443.  
  4444.      There are up to four command line arguments,  in addition to 
  4445. the command itself.   You do not have to enter leading zeros with 
  4446. any  command line argument.   Numbers are read in hexadecimal for 
  4447. the most part, as the IDM operates in the hexadecimal mode.
  4448.  
  4449.  
  4450. 5.2  IDM Vectors
  4451.  
  4452.      There  are just two vectors associated with the IDM  itself.  
  4453. The  most important vector is the starting location of  the  IDM.  
  4454. The  IDM starts at the top of it's location in 68000 memory (it's 
  4455. lowest  memory  address).   If IDM will occupy  memory  locations 
  4456. $4000 to $5FFF,  for instance, the IDM's starting address will be 
  4457. at $4000.
  4458.  
  4459.      The  breakpoint vector is located exactly 4 bytes  from  the 
  4460. starting vector.   The IDM presently uses Trap #0,  Trap #1,  and 
  4461. Trap  #2.   To use the IDM,  you must first point Trap #0 to  the 
  4462. correct AOS/68K dispatch routine that you are using.  Next, point 
  4463. Trap  #1 to AOS/68K "Entry ONE".   Finally,  point Trap #2 to the 
  4464. IDM breakpoint vector at location IDM+4.
  4465.  
  4466.      If your system has trap 0 - 2 already in use,  we will  make 
  4467. simple trap changes in the IDM at no additional charge.  Just let 
  4468. your  dealer  or CST know in advance what IDM trap  modifications 
  4469. are necessary, and we will be happy to make them for you.
  4470.  
  4471.  
  4472.  
  4473.  
  4474.  
  4475.  
  4476.  
  4477.  
  4478.  
  4479.  
  4480.  
  4481.  
  4482.  
  4483. Copyright (C) 1986, 1987 by Creative Software Technology,     5-3
  4484.  
  4485.  
  4486.  
  4487.  
  4488.  
  4489. Advance Operating System                                Chapter 5
  4490.  
  4491.  
  4492. 5.3.1     Edit Memory
  4493.  
  4494.      EDIT
  4495.  
  4496.      The  Edit Memory command is used to display memory a byte at 
  4497. a time.   You may also modify data or enter new data.   In  addi-
  4498. tion, you may also enter text into memory or execute subroutines.
  4499.  
  4500.      OPTION              DESCRIPTION
  4501.  
  4502.        S                 Skip one byte forward through memory
  4503.        R                 Return backwards one byte in memory
  4504.        /                 Look at the same memory location again
  4505.        X                 Execute subroutine at present address
  4506.      <0..F>              Enter Hexadecimal data into memory
  4507.        Gxxxx <CR>        Go to location xxxx in memory
  4508.        T                 Enter text mode; CTRL-C to exit mode
  4509.      <CR>                Enter <CR> to exit Edit Memory
  4510.  
  4511.      EXAMPLES:
  4512.  
  4513. IDM 1.0 >EDIT
  4514. 000000F0 00   + G4801
  4515. 00004801 FF   + S 
  4516. 00004802 FF   + R 
  4517. 00004801 FF   + R 
  4518. 00004800 DF   + / 
  4519. 00004800 DF   + 12 
  4520. 00004801 FF   + 34 
  4521. 00004802 56 V + R 
  4522. 00004801 34 4 + R 
  4523. 00004800 12   + S 
  4524. 00004801 34 4 + G4804
  4525. 00004804 FF   + T 
  4526. Structured^C
  4527. 0000480F 41 A + G4804
  4528. 00004804 53 S + S 
  4529. 00004805 74 t + S 
  4530. 00004806 72 r + S 
  4531. 00004807 75 u + S 
  4532. 00004808 63 c + S 
  4533. 00004809 74 t + S 
  4534. 0000480A 75 u + S 
  4535. 0000480B 72 r + S 
  4536. 0000480C 65 e + S 
  4537. 0000480D 64 d + S 
  4538. 0000480E 03   + G4810
  4539. 00004810 4E N + S
  4540. 00004811 75 u + R
  4541. 00004810 4E N + X
  4542. 00004810 4E N +
  4543. IDM 1.0 >
  4544.  
  4545.  
  4546.  
  4547.  
  4548.  
  4549. Copyright (C) 1986, 1987 by Creative Software Technology,     5-4
  4550.  
  4551.  
  4552.  
  4553.  
  4554.  
  4555. Advance Operating System                                Chapter 5
  4556.  
  4557.  
  4558.  
  4559. 5.3.2     Memory Dump
  4560.  
  4561.      MDMP xxx yyy
  4562.  
  4563.      The  MDMP  command  is used to display a section  of  memory 
  4564. beginning at address xxx and ending with the address yyy.  If xxx 
  4565. is greater than yyy then yyy equals the number of bytes of memory 
  4566. to dump.   The IDM runs in the background and the memory you want 
  4567. to display may be changing even as you display it.  If you want a 
  4568. "snapshot"  of  a section of memory,  block move the section  you 
  4569. want  to look at into a buffer with the BMOV command.   Once  the 
  4570. memory is in a static buffer you can view the memory with MDMP.
  4571.  
  4572.      EXAMPLES:
  4573.  
  4574. IDM 1.0 >MDMP 4800 481F
  4575. 004800  12 34 56 78 53 74 72 75  63 74 75 72 65 64 20 41  .4VxStructured A 
  4576. 004810  6E 61 6C 79 73 69 73 03  77 FF FF FF FF FF FF FF  nalysis.w....... 
  4577.  * 1020 * 
  4578.  
  4579. IDM 1.0 >MD 5700 20
  4580. 005700  44 65 73 69 67 6E 20 69  73 20 74 68 65 20 74 68  Design is the th 
  4581. 005710  69 6E 6B 69 6E 67 20 70  72 6F 63 65 73 73 20 74  inking process t 
  4582.  * 0BE6 *  
  4583.  
  4584.  
  4585.  
  4586.  
  4587. 5.3.3     Checksum Memory
  4588.  
  4589.      CHEK xxx yyy
  4590.  
  4591.      The  CHEK command  is used to checksum a section  of  memory 
  4592. beginning at address xxx and ending with the address yyy.  If xxx 
  4593. is greater than yyy then yyy equals the number of bytes of memory 
  4594. to checksum.
  4595.  
  4596.      EXAMPLES:
  4597.  
  4598.  
  4599. IDM 1.0 >CHEK 5700 20
  4600.  * 0BE6 *  
  4601.  
  4602. IDM 1.0 >CHEK 4800 481F
  4603.  * 1020 *
  4604.  
  4605.  
  4606.  
  4607.  
  4608.  
  4609.  
  4610.  
  4611.  
  4612.  
  4613.  
  4614.  
  4615. Copyright (C) 1986, 1987 by Creative Software Technology,     5-5
  4616.  
  4617.  
  4618.  
  4619.  
  4620.  
  4621. Advance Operating System                                Chapter 5
  4622.  
  4623.  
  4624. 5.3.4     Register Display
  4625.  
  4626.      REG xxx yyy zzz
  4627.  
  4628.      The  REG  command is used to display the  MC68000  processor 
  4629. registers  of the specified task.   The xxx parameter is the task 
  4630. id,  yyy ,  if present,  is the register you want to change  with 
  4631. parameter  zzz.   If  yyy and xxx are not present in the  command 
  4632. line,  then  task xxx's MC68000 processor registers  are  dumped.  
  4633. The  internal IDM REG software takes a "snapshot" of the register 
  4634. save  area  on  the target task's stack.   The  snapshot  of  the 
  4635. registers  is then formated and sent to the user  default  output 
  4636. device.   The registers that will be seen at any output baud rate 
  4637. are  the  stacked registers at the instant in time when the  user 
  4638. enters a <CR> in the command line just after the REG ..  command. 
  4639. All  data and address registers can be changed except the  system 
  4640. stack  pointer  and  the user stack  pointer  (A7).   The  Status 
  4641. Register  can be modified by the REG command by entering "SR"  as 
  4642. the yyy parameter.
  4643.  
  4644.  
  4645.  
  4646. IDM 1.0 >REG 5431 D4 12345
  4647.  
  4648. IDM 1.0 >REG 5431
  4649.  
  4650. PC=0000211C SR=0000  SYSTK=00007000  
  4651. D0=000001D0 D1=00000000 D2=00000000 D3=00000000  
  4652. D4=00012345 D5=00000075 D6=00000000 D7=000001D7  
  4653. A0=000001A0 A1=00003B16 A2=00000000 A3=00000000  
  4654. A4=00000000 A5=00003B1A A6=000001A6 A7=00003B02  
  4655.  
  4656. IDM 1.0 >REG 5431 PC ABCDEF
  4657.  
  4658. IDM 1.0 >REG 5431
  4659.  
  4660. PC=00ABCDEF SR=0000  SYSTK=00007000  
  4661. D0=000001D0 D1=00000000 D2=00000000 D3=00000000  
  4662. D4=00012345 D5=00000075 D6=00000000 D7=000001D7  
  4663. A0=000001A0 A1=00003B16 A2=00000000 A3=00000000  
  4664. A4=00000000 A5=00003B1A A6=000001A6 A7=00003B02  
  4665.  
  4666. IDM 1.0 >
  4667.  
  4668.  
  4669.  
  4670.  
  4671.  
  4672.  
  4673.  
  4674.  
  4675.  
  4676.  
  4677.  
  4678.  
  4679.  
  4680.  
  4681. Copyright (C) 1986, 1987 by Creative Software Technology,     5-6
  4682.  
  4683.  
  4684.  
  4685.  
  4686.  
  4687. Advance Operating System                                Chapter 5
  4688.  
  4689.  
  4690. 5.3.4     No Breakpoint
  4691.  
  4692.      NBRK xxxx
  4693.  
  4694.      The  NBRK instruction information was presented here  before 
  4695. the  breakpoint information so that references to NBRK  could  be 
  4696. made.   Please  see  the  section on breakpoints for  a  complete 
  4697. discussion on the use of breakpoints.  There are certain restric-
  4698. tions on the use of breakpoints.  
  4699.  
  4700.      The  NBRK  command is used to remove a breakpoint  from  the 
  4701. internal  breakpoint table,  and functions as the inverse of  the 
  4702. BPNT  command  (the BPNT command puts breakpoints into user  pro-
  4703. grams).  If a task had formerly encountered a certain breakpoint, 
  4704. then  if  the NBRK command is executed with  the  xxxx  parameter 
  4705. equal to the original breakpoint parameter, that task will return 
  4706. back  to its original instruction.   The task would continue from 
  4707. where the breakpoint was to wherever the remaining code takes the 
  4708. task.
  4709.  
  4710.      When the user removes the breakpoint that caused the task to 
  4711. become inactive,  the IDM puts the original instruction back into 
  4712. the  code  and activates the task made inactive by a  breakpoint. 
  4713. Parameter  xxxx  is the former breakpoint address.   If  NBRK  is 
  4714. entered with no argument, then ALL of the breakpoints are removed 
  4715. at the same time.   Many tasks could possibly spring back to life 
  4716. with  a  single NBRK <CR> command.   This assumes each  task  had 
  4717. already encountered a breakpoint.
  4718.  
  4719.      Sometimes  the NBRK command returns "NO BREAKPOINTS".   This 
  4720. occurs  just after you have removed a breakpoint and there are no 
  4721. breakpoints  left  in the breakpoint  table.   In  the  following 
  4722. example  there was a breakpoint already in the breakpoint  table.  
  4723. The original breakpoint was at $211C.
  4724.  
  4725.      EXAMPLE:
  4726.  
  4727.  
  4728. IDM 1.0 >NBRK 211C
  4729. NO BREAKPOINTS 
  4730.  
  4731. IDM 1.0 >
  4732.  
  4733.  
  4734.  
  4735.  
  4736.  
  4737.  
  4738.  
  4739.  
  4740.  
  4741.  
  4742.  
  4743.  
  4744.  
  4745.  
  4746.  
  4747. Copyright (C) 1986, 1987 by Creative Software Technology,     5-7
  4748.  
  4749.  
  4750.  
  4751.  
  4752.  
  4753. Advance Operating System                                Chapter 5
  4754.  
  4755.  
  4756. 5.3.5     Breakpoint
  4757.  
  4758.      BPNT xxx
  4759.  
  4760.      Parameter xxx is the even word address of where you want the 
  4761. breakpoint  to  be placed.   If xxx is not an even word  then  an 
  4762. error  message  is displayed.   Once the breakpoint parameter  is 
  4763. placed in memory and the opcode saved, etc., the IDM displays all 
  4764. of the breakpoint addresses in the breakpoint table.   If BPNT is 
  4765. entered with no arguments, then a list of outstanding breakpoints 
  4766. is output to the user default output device.
  4767.  
  4768.      When  a task (or module) encounters a breakpoint,  that task 
  4769. is made inactive by the IDM breakpoint software.   When the  user 
  4770. removes  the breakpoint that caused the task to become  inactive, 
  4771. the  IDM  puts  the original instruction back into the  code  and 
  4772. activates the task.   The BPNT command sets one address into  the 
  4773. breakpoint  address table.   The breakpoint table can hold up  to 
  4774. eight breakpoint addresses.
  4775.  
  4776.      After  the  breakpoint has been entered into the  breakpoint 
  4777. table,  the  original  opcode  is  saved and  the  breakpoint  is 
  4778. inserted into the actual code.   If the IDM software notices that 
  4779. the code is not modified (such as trying to put a breakpoint  in 
  4780. ROM) then an error message is returned: BREAKPOINT DID NOT STORE.  
  4781. Breakpoints will only work in a RAM debugging environment.
  4782.  
  4783.      A  TRAP #2 instruction is inserted into the user program  as 
  4784. soon  as  a <CR> is entered in the command line.   Since the  IDM 
  4785. operates  in the background,  a breakpoint may occur immediately.  
  4786. When  a  task hits a breakpoint,  the task id for the  module  is 
  4787. immediately displayed and then the symbol "@BP" just to the right 
  4788. of  the task id.   In the following example their was a task with 
  4789. an id of "T1" that immediately hit the breakpoint as soon as  the 
  4790. user  hit  the <CR> key.   The run time breakpoint software  dis-
  4791. played the "5431 @BP" and the IDM displayed the "00211C".
  4792.  
  4793.      EXAMPLE:
  4794.  
  4795. IDM 1.0 >BPNT 211C
  4796. 5431 @BP 
  4797. 00211C
  4798.  
  4799. IDM 1.0 >REG 5431
  4800.  
  4801. PC=0000211C SR=0000  SYSTK=00007000  
  4802. D0=000001D0 D1=00000000 D2=00000000 D3=00000000  
  4803. D4=00000000 D5=00000075 D6=00000000 D7=000001D7  
  4804. A0=000001A0 A1=00003B16 A2=00000000 A3=00000000  
  4805. A4=00000000 A5=00003B1A A6=000001A6 A7=00003B02  
  4806.  
  4807. IDM 1.0 >NBRK 211C
  4808. NO BREAKPOINTS 
  4809.  
  4810.  
  4811.  
  4812.  
  4813. Copyright (C) 1986, 1987 by Creative Software Technology,     5-8
  4814.  
  4815.  
  4816.  
  4817.  
  4818.  
  4819. Advance Operating System                                Chapter 5
  4820.  
  4821.  
  4822.  
  4823. IDM 1.0 >REG 5431
  4824.  
  4825. PC=00002118 SR=0000  SYSTK=00007000  
  4826. D0=000001D0 D1=00000000 D2=00000000 D3=00000000  
  4827. D4=00000000 D5=000000A7 D6=00000000 D7=000001D7  
  4828. A0=000001A0 A1=00003B16 A2=00000000 A3=00000000  
  4829. A4=00000000 A5=00003B1A A6=000001A6 A7=00003B02  
  4830.  
  4831. IDM 1.0 >BPNT
  4832. NO BREAKPOINTS 
  4833.  
  4834. IDM 1.0 >BPNT 211A
  4835. 5431 @BP 
  4836. 00211A
  4837.  
  4838. IDM 1.0 >BPNT 2156
  4839. 00211A
  4840. 5432 @BP 
  4841. 002156
  4842.  
  4843. IDM 1.0 >BPNT
  4844. 00211A 
  4845. 002156
  4846.  
  4847. IDM 1.0 >NBRK 211A
  4848. 002156
  4849.  
  4850. IDM 1.0 >BPNT
  4851. 002156
  4852.  
  4853. IDM 1.0 >NBRK 2155
  4854. INVALID BREAKPOINT ADDRESS 
  4855.  
  4856. IDM 1.0 >NBRK 2154
  4857. BREAKPOINT NOT IN TABLE
  4858.  
  4859. IDM 1.0 >NBRK 2156
  4860. NO BREAKPOINTS 
  4861.  
  4862. IDM 1.0 >
  4863.  
  4864.  
  4865.                          - PLEASE NOTE -
  4866.  
  4867.      Tasks that will be debugged using breakpoints have to regis-
  4868. ter  a  mailbox  with  AOS.   This is easily done  with  the  AOS 
  4869. post_box command.   The breakpoint software is the only IDM  fea-
  4870. ture  that requires use of an already working task mailbox.   The 
  4871. task mailbox itself is very easy to set up by using the  examples 
  4872. in the AOS User Manual manual.   If the same task will be receiv-
  4873. ing  letters  from  all  the other  tasks,  then  make  parameter 
  4874. MAX_LTRS equal to the number of registered tasks,  plus one,  and 
  4875. there should never be a problem with breakpoints.
  4876.  
  4877.  
  4878.  
  4879. Copyright (C) 1986, 1987 by Creative Software Technology,     5-9
  4880.  
  4881.  
  4882.  
  4883.  
  4884.  
  4885. Advance Operating System                                Chapter 5
  4886.  
  4887.  
  4888.      Breakpoints must be used in the user mode only.   For proper 
  4889. breakpoint operation,  place breakpoints in sections of code that 
  4890. a known,  registered task,  operating in the user mode,  will  be 
  4891. encountering.   Please do not place breakpoints in interrupt rou-
  4892. tines.   For  debugging  interrupt routines you will have to  use 
  4893. some other debugging technique,  such as desk-checking,  a  logic 
  4894. analyser, tracing, etc.
  4895.  
  4896.      We  are  constantly improving the ADVANCE  Operating  System 
  4897. Tools.   We  may already have interrupt debugging tools not  men-
  4898. tioned in this edition of the IDM manual.  The present breakpoint 
  4899. restrictions are,  in practice, very minimal.  The IDM breakpoint 
  4900. software  works very well in a majority of debugging  situations.  
  4901. We will be sending additional IDM debugging information to all of 
  4902. our registered customers as soon as enhancements are available.
  4903.  
  4904.                            *    *    *
  4905.  
  4906.  
  4907.  
  4908.  
  4909.  
  4910.  
  4911.  
  4912.  
  4913.  
  4914.  
  4915.  
  4916.  
  4917.  
  4918.  
  4919.  
  4920.  
  4921.  
  4922.  
  4923.  
  4924.  
  4925.  
  4926.  
  4927.  
  4928.  
  4929.  
  4930.  
  4931.  
  4932.  
  4933.  
  4934.  
  4935.  
  4936.  
  4937.  
  4938.  
  4939.  
  4940.  
  4941.  
  4942.  
  4943.  
  4944.  
  4945. Copyright (C) 1986, 1987 by Creative Software Technology,     5-10
  4946.  
  4947.  
  4948.  
  4949.  
  4950.  
  4951. Advance Operating System                                Chapter 5
  4952.  
  4953.  
  4954. 5.3.6     Fill Block of Memory
  4955.      
  4956.      MFIL xxx yyy zzz
  4957.  
  4958.      The Fill Block of Memory command fills memory with parameter 
  4959. zzz.   Parameter zzz is a word size.  Parameter xxx is the begin-
  4960. ning  address of where to start filling memory and parameter  yyy 
  4961. is  the ending address of where to stop filling memory with  word 
  4962. size  parameter zzz.   Both xxx and yyy must be  even  addresses.  
  4963. If,  however,  yyy is less than xxx, then yyy is considered to be 
  4964. the  number of words you want to fill starting at  location  xxx.  
  4965. If  yyy  is less than xxx,  then yyy does not have to be an  even 
  4966. word, of course.  It is just a counter value.
  4967.  
  4968.      EXAMPLES:
  4969.  
  4970. IDM 1.0 >MDMP 5900 30
  4971.  
  4972. 005900  DF FF FF FF FF FF 19 F6  FF FF FF FF FF FF FF FF  ................ 
  4973. 005910  FF FF FF FF FF FF FF FF  FF FF FF FF FF FF FF FF  ................ 
  4974. 005920  FF FF FF FF FF FF FF FF  FF FF FF FF FF FF FF FF  ................ 
  4975.  
  4976.  * 2EC1 *  
  4977. IDM 1.0 >FMEM 5910 8 ABCD
  4978.  
  4979. IDM 1.0 >MDMP 5900 592F
  4980.  
  4981. 005900  DF FF FF FF FF FF 19 F6  FF FF FF FF FF FF FF FF  ................ 
  4982. 005910  AB CD AB CD AB CD AB CD  AB CD AB CD AB CD AB CD  ................ 
  4983. 005920  FF FF FF FF FF FF FF FF  FF FF FF FF FF FF FF FF  ................ 
  4984.  
  4985.  * 2A91 *  
  4986. IDM 1.0 >FMEM 5910 591F 0123
  4987. EVEN ADRS REQ FOR WORD FILL
  4988.  
  4989. IDM 1.0 >FMEM 5910 591E 3210
  4990.  
  4991. IDM 1.0 >MDMP 5900 30
  4992.  
  4993. 005900  DF FF FF FF FF FF 19 F6  FF FF FF FF FF FF FF FF  ................ 
  4994. 005910  32 10 32 10 32 10 32 10  32 10 32 10 32 10 32 10  2.2.2.2.2.2.2.2. 
  4995. 005920  FF FF FF FF FF FF FF FF  FF FF FF FF FF FF FF FF  ................ 
  4996.  
  4997.  * 20E1 *  
  4998.  
  4999.  
  5000.  
  5001.  
  5002.  
  5003.  
  5004.  
  5005.  
  5006.  
  5007.  
  5008.  
  5009.  
  5010.  
  5011. Copyright (C) 1986, 1987 by Creative Software Technology,     5-11
  5012.  
  5013.  
  5014.  
  5015.  
  5016.  
  5017. Advance Operating System                                Chapter 5
  5018.  
  5019.  
  5020. 5.3.7     Block Move a Block of Memory
  5021.  
  5022.      BMOV xxx yyy zzz
  5023.  
  5024.      Block Move moves a block of memory starting from address xxx 
  5025. to  address  yyy  to a second block of memory  area  starting  at 
  5026. address zzz.   If parameter yyy is less than xxx then yyy is  the 
  5027. number  of BYTES to block move.   You may use even or odd address 
  5028. for  the  beginning  and ending address parameters  in  the  BMOV 
  5029. command.   Memory can be moved over itself in either an upward or 
  5030. downward direction.
  5031.  
  5032.      EXAMPLES:
  5033.  
  5034. IDM 1.0 >MDMP 56F0 572F
  5035.  
  5036. 0056F0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................ 
  5037. 005700  44 65 73 69 67 6E 20 69  73 20 74 68 65 20 74 68  Design is the th 
  5038. 005710  69 6E 6B 69 6E 67 20 70  72 6F 63 65 73 73 20 74  inking process t 
  5039. 005720  68 61 74 20 68 61 73 20  74 6F 20 70 72 65 63 65  hat has to prece 
  5040.  
  5041.  * 11B1 *  
  5042. IDM 1.0 >BMOV 5700 20 56FA
  5043.  
  5044. IDM 1.0 >MDMP 56F0 572F
  5045.  
  5046. 0056F0  00 00 00 00 00 00 00 00  00 00 44 65 73 69 67 6E  ..........Design 
  5047. 005700  20 69 73 20 74 68 65 20  74 68 69 6E 6B 69 6E 67   is the thinking 
  5048. 005710  20 70 72 6F 63 65 73 73  20 74 63 65 73 73 20 74   process tcess t 
  5049. 005720  68 61 74 20 68 61 73 20  74 6F 20 70 72 65 63 65  hat has to prece 
  5050.  
  5051.  * 13F3 *  
  5052. IDM 1.0 >MDMP 57F0 582F
  5053.  
  5054. 0057F0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................ 
  5055. 005800  44 65 73 69 67 6E 20 69  73 20 74 68 65 20 74 68  Design is the th 
  5056. 005810  69 6E 6B 69 6E 67 20 70  72 6F 63 65 73 73 20 74  inking process t 
  5057. 005820  68 61 74 20 68 61 73 20  74 6F 20 70 72 65 63 65  hat has to prece 
  5058.  
  5059.  * 11B1 *  
  5060. IDM 1.0 >BMOV 5800 581F 5807
  5061.  
  5062. IDM 1.0 >MD 57F0 582F
  5063.  
  5064. 0057F0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................ 
  5065. 005800  44 65 73 69 67 6E 20 44  65 73 69 67 6E 20 69 73  Design Design is 
  5066. 005810  20 74 68 65 20 74 68 69  6E 6B 69 6E 67 20 70 72   the thinking pr 
  5067. 005820  6F 63 65 73 73 20 74 20  74 6F 20 70 72 65 63 65  ocess t to prece 
  5068.  
  5069.  * 1192 *  
  5070.  
  5071. IDM 1.0 >
  5072.  
  5073.  
  5074.  
  5075.  
  5076.  
  5077. Copyright (C) 1986, 1987 by Creative Software Technology,     5-12
  5078.  
  5079.  
  5080.  
  5081.  
  5082.  
  5083. Advance Operating System                                Chapter 5
  5084.  
  5085.  
  5086. 5.3.8     Help with Commands
  5087.  
  5088.      HELP
  5089.  
  5090.      The  HELP command presently displays the commands  that  are 
  5091. available  to the user.   In order to save some code space,  just 
  5092. the  commands are displayed,  not how to use them.   Once you are 
  5093. familiar  with the IDM commands,  you may use just the first  two 
  5094. letters of each command.  
  5095.  
  5096.  
  5097. IDM 1.0 >HELP
  5098.  
  5099. EDIT  MDMP  CHEK  BPNT  NBRK  HELP  ECHO  REG 
  5100. FMEM  BMOV  STOR  SRCH  LOAD  STAT  ON    OFF  
  5101. LINK
  5102.  
  5103. IDM 1.0 >
  5104.  
  5105.  
  5106. 5.3.9     Store Parameter
  5107.  
  5108.      STOR xxxx y zzzz
  5109.  
  5110.      Store parameter is used to store a word or long word parame-
  5111. ter in memory.   Since the IDM is frequently running in the back-
  5112. ground,  you may have to modify some addresses and data with  one 
  5113. store to memory.  Another program may be actively looking at some 
  5114. parameter (IDM Edit Memory command EDIT,  can change a byte at  a 
  5115. time  and  is not be designed to change an address with just  one 
  5116. store  to memory).   Parameter xxxx is the parameter you wish  to 
  5117. store to memory at even address location zzzz.   Parameter "y" is 
  5118. either a "W" or a "L",  which stands for Word stores or Long word 
  5119. stores.
  5120.  
  5121.      EXAMPLES:
  5122.  
  5123. IDM 1.0 >STOR ABCD L 5708
  5124.  
  5125. IDM 1.0 >MDMP 56F0 571F
  5126.  
  5127. 0056F0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................ 
  5128. 005700  00 00 AB CD 67 6E 20 69  73 20 74 68 65 20 74 68  ....gn is the th 
  5129. 005710  69 6E 6B 69 6E 67 20 70  72 6F 63 65 73 73 20 74  inking process t 
  5130.  * 1692 *  
  5131.  
  5132.  
  5133.  
  5134.  
  5135.  
  5136.  
  5137.  
  5138.  
  5139.  
  5140.  
  5141.  
  5142.  
  5143. Copyright (C) 1986, 1987 by Creative Software Technology,     5-13
  5144.  
  5145.  
  5146.  
  5147.  
  5148.  
  5149. Advance Operating System                                Chapter 5
  5150.  
  5151.  
  5152. 5.1.0     Block of Memory Search
  5153.  
  5154.      SRCH wwww xxxx yyyy zzzz
  5155.  
  5156.      The  block  of Memory Search function,  SRCH,  searches  for 
  5157. either  a  byte,  word,  or  long  word in  a  block  of  memory.  
  5158. Parameter  wwww is the starting address,  parameter xxxx  is  the 
  5159. ending  address,   and  yyyy  is  the  argument  to  search  for.  
  5160. Parameter zzzz is either a "B", "W", or "L".
  5161.  
  5162.      EXAMPLES:
  5163.  
  5164. IDM 1.0 >SRCH 1000 2000 234 W
  5165. 001703 0234
  5166.  
  5167. IDM 1.0 >
  5168.  
  5169.  
  5170. 5.1.1     System Status
  5171.  
  5172.      STAT xxxx
  5173.  
  5174.      IDM  command STAT returns the status of the specified  task.  
  5175. If  parameter  xxxx is present,  STAT returns just the status  of 
  5176. that task,  whether it is active or inactive (or non-registered).  
  5177. If  parameter xxxx is not present in the command line  then  STAT 
  5178. returns the status of every registered task.   If you enter  STAT 
  5179. with no task id's, the resulting dump of tasks STATUS information 
  5180. may  not be representative of the real system under  examination.  
  5181. IDM  command  STAT  gets the status of each task just  before  it 
  5182. outputs each line of STATUS information.  The task ID's and their 
  5183. names are correct, of course, but in between the time IDM went to 
  5184. get the task status and the time it was displayed,  the task  may 
  5185. have been turned on or off.
  5186.  
  5187.      EXAMPLES:
  5188.  
  5189. IDM 1.0 >STAT 5431
  5190.  
  5191. TASK ID   TASK NAME      STATUS
  5192.   5431    "Mod One "      ACTIVE
  5193.  
  5194. IDM 1.0 >STAT
  5195.  
  5196. TASK ID   TASK NAME      STATUS
  5197.   5431    "Mod One "      ACTIVE
  5198.   5432    "Mod Two "      INACTIVE
  5199.  
  5200. IDM 1.0 >
  5201.  
  5202.  
  5203.  
  5204.  
  5205.  
  5206.  
  5207.  
  5208.  
  5209. Copyright (C) 1986, 1987 by Creative Software Technology,     5-14
  5210.  
  5211.  
  5212.  
  5213.  
  5214.  
  5215. Advance Operating System                                Chapter 5
  5216.  
  5217.  
  5218. 5.1.2     Echo to Output Device
  5219.  
  5220.      ECHO
  5221.  
  5222.      The IDM command ECHO toggles the ECHO flag.   The ECHO  flag 
  5223. is usually set to true and can be shut off by entering ECHO <CR>.
  5224. When you send characters to the IDM through the input device  and 
  5225. the ECHO flag is ON,  then all characters sent to the IDM will be 
  5226. echoed back to the input device.
  5227.  
  5228. 5.1.3     Turn On a Task
  5229.  
  5230.      ON xxxx
  5231.  
  5232.      The IDM command "ON" turns on any inactive task.   Parameter 
  5233. xxxx is the task id of the task you want to turn on.
  5234.  
  5235. 5.1.4     Turn Off a Task
  5236.  
  5237.      OFF xxxx
  5238.  
  5239.      The IDM command "OFF" turns off any active task.   Parameter 
  5240. xxxx is the task id of the task you want to turn off.
  5241.  
  5242. 5.1.5     Load a File
  5243.  
  5244.      LOAD xxxx
  5245.  
  5246.      AOS  command  LOAD  loads files in the Motorola  S19  record 
  5247. format. Parameter xxxx is a 2's compliment offset, which is added 
  5248. to the load offset of each incomming S1 record.
  5249.  
  5250.  
  5251. 5.1.6     Link Default Devices
  5252.  
  5253.      LINK
  5254.  
  5255.      The  IDM  command  LINK connects together  the  default  I/O 
  5256. device  number  one with default I/O device  number  two.   If  a 
  5257. development  station is connected to device number two,  then you 
  5258. can make changes to your source file,  through the IDM,  all  the 
  5259. time while your former object code is running.   When changes are 
  5260. made to the source and you have compiled and linked your changes, 
  5261. you  may download the new object file through default I/O  device 
  5262. number  two.   Two exit the LINK mode,  enter a CTRL-Y.
  5263.  
  5264.      You may write a small routine for the development station to 
  5265. delay  for about 20 - 30 seconds while you exit the LINK mode and 
  5266. use the IDM LOAD command.   Many development systems support some 
  5267. sort of BATCH processing command language (JCL,  VCL,  etc) which 
  5268. makes programmed delays and such very easy to impliment.  You may 
  5269. also  write a macro command to do the prompting from  both  ends.  
  5270. The IDM supports both envorinments.
  5271.  
  5272.  
  5273.  
  5274.  
  5275. Copyright (C) 1986, 1987 by Creative Software Technology,     5-15
  5276.  
  5277.  
  5278.  
  5279.  
  5280.  
  5281. Advance Operating System                                Chapter 5
  5282.  
  5283.  
  5284.  
  5285. 5.4.0     Information for Advanced Programmers
  5286.  
  5287. 5.4.1     Breakpoints
  5288.  
  5289.      When  a breakpoint is encountered,  the breakpoint  software 
  5290. saves the contents of the task's mailbox. The breakpoint software 
  5291. makes  the  task that encounters a breakpoint send a letter  with 
  5292. the  address  of the breakpoint to  the  IDM.     The  breakpoint 
  5293. software  then forces the task to make a call to the AOS  command 
  5294. "receive,"  and turns off the calling task until the IDM sends  a 
  5295. letter  to the inactive task.   When instructed by the user,  via 
  5296. IDM's NBRK command,  the IDM sends a letter to the inactive task.  
  5297. The original task environment is restored, the original opcode is 
  5298. put back into the code and the task is then reactivated.
  5299.  
  5300.  
  5301.  
  5302.  
  5303.  
  5304.  
  5305.  
  5306.  
  5307.  
  5308.  
  5309.  
  5310.  
  5311.  
  5312.  
  5313.  
  5314.  
  5315.  
  5316.  
  5317.  
  5318.  
  5319.  
  5320.  
  5321.  
  5322.  
  5323.  
  5324.  
  5325.  
  5326.  
  5327.  
  5328.  
  5329.  
  5330.  
  5331.  
  5332.  
  5333.  
  5334.  
  5335.  
  5336.  
  5337.  
  5338.  
  5339.  
  5340.  
  5341. Copyright (C) 1986, 1987 by Creative Software Technology,     5-16
  5342.  
  5343.  
  5344.  
  5345.  
  5346.  
  5347.     *** Advance Operating System Setup Examples ***
  5348.  
  5349.  
  5350.         TITLE           SAMPLE.ASM
  5351. *
  5352. *                               EXAM.ASM
  5353. *
  5354. *                 Example Assembly Language Setup Code
  5355. *
  5356. *                       DATE:         01.09.86
  5357. *                       REVISED:      02.25.86
  5358. *
  5359. *           This section of assembler code is included so  programmers 
  5360. *     can  see exactly how to set up mailboxes,  tasks,  and so  forth.  
  5361. *     The  following  code  originally  comes from  a  regression  test 
  5362. *     program that was used to test the IDM.  The entire listing is not
  5363. *     reproduced, just the setup code.  This code ran on a MEX68KECB/D2
  5364. *     (Motorola 68000 trainer) board.
  5365. *
  5366.         EXTERN  REGD
  5367.         EXTERN  FILL
  5368.         EXTERN  BLKM
  5369.         EXTERN  ST
  5370.         EXTERN  LOAD
  5371.         EXTERN  ON
  5372.         EXTERN  OFF
  5373. *
  5374.         GLOBAL  RDCHAR
  5375.         GLOBAL  PRCHAR
  5376.         GLOBAL  RDHEX
  5377.         GLOBAL  PRHEX
  5378.         GLOBAL  TALK
  5379.         GLOBAL  CRLFED
  5380. *
  5381. *============== EQUATES:
  5382. *                       
  5383. _BYTE   EQU     1
  5384. _WORD   EQU     _BYTE*2
  5385. _LONG   EQU     _WORD*2
  5386. *
  5387. *  AOS Commands:
  5388. *
  5389. SEND    EQU     $09
  5390. SENDX   EQU     $0B             NEW SEND CMD;
  5391. RDCX    EQU     $98             Bit 7 set! No task switch.
  5392. PRCX    EQU     $99             Bit 7 set! No task switch.
  5393. KY_STA1 EQU     $1A             Added extra command 02.10.87
  5394. TR_STA1 EQU     $1B             Added extra command 02.16.87
  5395. POSTBX  EQU     $48
  5396. RECEIVE EQU     $14A
  5397. GT_CPT  EQU     $20             %0010 0000 - Not necessary to set bit 7;
  5398. *
  5399. EMPTY   EQU     0
  5400. LETTE   EQU     2               TASK MAILBOXES HOLD ONLY 2 LETTERS;
  5401. LETTERS EQU     8               OUR MAILBOX HOLDS 8 LETTERS;
  5402. ETX     EQU     3
  5403. CTRLC   EQU     $03             RESTART THE INPUT COMMAND LINE (^C);
  5404.  
  5405.  
  5406.  
  5407. Creative Software Technology Assembler Setup Examples     Page 1
  5408.  
  5409.  
  5410.  
  5411.  
  5412.  
  5413.     *** Advance Operating System Setup Examples ***
  5414.  
  5415.  
  5416. BEL     EQU     $07             BEEP (WARNING MESSAGE);
  5417. BS      EQU     $08             BACK SPACE;
  5418. TAB     EQU     $09             TAB;
  5419. CR      EQU     $0D             CARRIAGE RETURN;
  5420. LF      EQU     $0A
  5421. CTRLX   EQU     $18             RESTART THE INPUT COMMAND LINE (^X);
  5422. CTRLZ   EQU     $1A             REPRINT THE PREVIOUS INPUT COMMAND LINE (^Z);
  5423. SPC     EQU     $20             SPACE; 
  5424. OUTPUT  EQU     243             TRPA 14 FUNCTION # - OUTPUT STRINTG TO PORT 1;
  5425. INCHE   EQU     247             TRAP 14 FUNCTION # - INPUT SINGLE CHARACTER;
  5426. OUTCH   EQU     248             TRAP 14 FUNCTION # - OUTPUT SINGLE CHARACTER;
  5427. *
  5428. *============== BREAKPOINT EQUATES:
  5429. *
  5430. MSIZE   EQU     8               SIZE, OR WIDTH OF LETTERS IN MAIL BOX;
  5431. NUMBPS  EQU     8               EIGHT BREAKPOINTS ARE ALLOWED;
  5432. *
  5433. SP_MSK  EQU     $D0
  5434. TSKID   EQU     $04
  5435. NBR_BP  EQU     $08             THERE ARE 8 BREAKPOINTS IN THE TABLE
  5436. BREAK   EQU     $4E42           EQU "BREAK" ($4E42) IS A TRAP #2 COMMAND;
  5437. SS_SIZE EQU     256             SYSTEM STACK SIZE;
  5438. *
  5439. INACTV  EQU     0
  5440. ACTIVE  EQU     1
  5441. *
  5442. TASK1   EQU     1
  5443. TASK2   EQU     2
  5444. *
  5445. TRAP0V  EQU     $80
  5446. TRAP1V  EQU     $84
  5447. TRAP2V  EQU     $88
  5448. *
  5449.         DATA
  5450. *
  5451. *============== STACK FRAME:
  5452. *
  5453. LOCALS  EQU     0
  5454. *
  5455. *  Breakpoint table is an array 8 bytes wide by 8 long:
  5456. *
  5457. *                 # of |      2    |       breakpoint      |
  5458. *                 hits  <--bytes--> <------ address ------>
  5459. *          -------------------------------------------------
  5460. *     1    |  :  |  :  |  :  |  :  |  :  |  :  |  :  |  :  |
  5461. *          |--:--|--:--|--:--|--:--|--:--|--:--|--:--|--:--|
  5462. *     2    |  :  |  :  |  :  |  :  |  :  |  :  |  :  |  :  |
  5463. *          |--:--|--:--|--:--|--:--|--:--|--:--|--:--|--:--|
  5464. *     :
  5465. *          |--:--|--:--|--:--|--:--|--:--|--:--|--:--|--:--|
  5466. *     8    |  :  |  :  |  :  |  :  |  :  |  :  |  :  |  :  |
  5467. *          -------------------------------------------------
  5468. *          | val |     |   actual  |           4           |
  5469. *          op code      <-op code-> <------- bytes ------->
  5470.  
  5471.  
  5472.  
  5473. Creative Software Technology Assembler Setup Examples     Page 2
  5474.  
  5475.  
  5476.  
  5477.  
  5478.  
  5479.     *** Advance Operating System Setup Examples ***
  5480.  
  5481.  
  5482. *
  5483.         ORG     LOCALS          DUMMY STACK TEMPLATE;
  5484.         RMB     _BYTE
  5485. VOC     EQU     $-LOCALS        Valid Op Code;
  5486.         RMB     _BYTE
  5487. NOH     EQU     $-LOCALS        Number Of Hits;
  5488.         RMB     _WORD
  5489. OPC     EQU     $-LOCALS        OP Code;
  5490.         RMB     _LONG
  5491. BPA     EQU     $-LOCALS        BreakPoint Address;
  5492. BPT_WD  EQU     BPA             BreakPointTable WiDth;
  5493. *
  5494.         ORG     LOCALS
  5495. MEASUR  EQU     $
  5496. RECVR   RMB     _LONG
  5497. SENDR   RMB     _LONG
  5498. ATRIB   RMB     _LONG
  5499. MLBOX   RMB     _LONG
  5500. POBSZ   EQU     $-MEASUR
  5501. *
  5502.         ORG     LOCALS                  BREAKPOINT HANDLER MAILBOX TEMPLATE;
  5503. MF      RMB     2                       MAIL FLAG;
  5504. ML      RMB     2                       MAX LETTERS;
  5505. LT      EQU     $-MF
  5506. *
  5507.         ORG     LOCALS
  5508. VALID   RMB     _LONG
  5509. RAMPTR  RMB     _LONG
  5510. RAMSIZE RMB     _LONG
  5511. AUXRST  RMB     _LONG
  5512. AUXDSP  RMB     _LONG
  5513. SERVPTR RMB     _LONG
  5514. DATAPTR RMB     _LONG
  5515. NTASKS  RMB     _LONG
  5516. *
  5517. *  Now set up stack frames for dummy tasks.  Each task must have mail box.
  5518. *
  5519.         ORG     LOCALS
  5520. A5L     RMB     _LONG
  5521. MFRAM   EQU     $
  5522.         RMB     _LONG
  5523. STATZ   EQU     $-MFRAM
  5524.         RMB     2               Reserve space for mailbox flag;
  5525. MLFLAG  EQU     $-MFRAM
  5526.         RMB     2               Reserve space for number of letters;
  5527. MXLTRS  EQU     $-MFRAM
  5528.         RMB     _LONG*4         LEAVE ROOM FOR 2 LETTERS;
  5529. PSIZ    EQU     $-MFRAM
  5530. *
  5531. *  Now make room for breakpoint software mail box and other parameters:
  5532. *
  5533.  
  5534.  
  5535.  
  5536.  
  5537.  
  5538.  
  5539. Creative Software Technology Assembler Setup Examples     Page 3
  5540.  
  5541.  
  5542.  
  5543.  
  5544.  
  5545.     *** Advance Operating System Setup Examples ***
  5546.  
  5547.  
  5548.         RMB     2               Reserve space for mailbox flag;
  5549. ML_FLAG EQU     $-FRAME
  5550.         RMB     2               Reserve space for number of letters;
  5551. MX_LTRS EQU     $-FRAME
  5552.         RMB     MSIZE*NUMBPS    8 LETTERS, ONE EACH FOR EACH BREAKPOINT;
  5553. BPT     EQU     $-FRAME
  5554.         RMB     64              Reserve space for NUMBPS breakpoints (8?).
  5555.         RMB     70
  5556. RSA     EQU     $-FRAME
  5557. *
  5558. PSIZE   EQU     $-FRAME
  5559. *
  5560. *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  5561. *                                                               %
  5562. *               START OF EXAMPLE APPLICATION PROGRAM            %
  5563. *                                                               %
  5564. *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  5565. *
  5566.         CODE
  5567. *
  5568.         ORG     $2000
  5569. *       
  5570. _VALID  BYTE    'VLID'
  5571. _RAMPTR LONG    $3800
  5572. _RAMSIZ LONG    $1000
  5573. _AUXRST LONG    $0000
  5574. _AUXDSP LONG    $0000
  5575. _SRVPTR LONG    SERVEC
  5576. _DPTR   LONG    SSTACK
  5577. _NTASKS LONG    $0003
  5578. *
  5579.         LONG    DUMY1
  5580.         BYTE    'Mod One '
  5581.         LONG    $200
  5582.         LONG    $0000
  5583.         LONG    $0000
  5584.         WORD    ACTIVE
  5585.         .BYTE   'T1'
  5586. *
  5587.         LONG    DUMY2
  5588.         BYTE    'Mod Two '
  5589.         LONG    $200
  5590.         LONG    $0000
  5591.         LONG    $0000
  5592.         WORD    INACTV                  SOMETHING DIFFERENT FOR A CHANGE;
  5593.         .BYTE   'T2'
  5594. *
  5595.         LONG    IDM
  5596.         BYTE    'Mod Thre'
  5597.         LONG    $280
  5598.         LONG    $0000
  5599.         LONG    $0000
  5600.         WORD    ACTIVE
  5601.         .BYTE   'ID'                    UNIQUE TASK_ID FOR IDM MODULE;
  5602.  
  5603.  
  5604.  
  5605. Creative Software Technology Assembler Setup Examples     Page 4
  5606.  
  5607.  
  5608.  
  5609.  
  5610.  
  5611.     *** Advance Operating System Setup Examples ***
  5612.  
  5613.  
  5614. *
  5615. *============== SERVEC:
  5616. *
  5617. *  The service vector locations will be 16 vectors (eventually).  The
  5618. *  first 8 are reserved for in_character, out_character, etc.  The last
  5619. *  eight are user defined service routines.
  5620. *
  5621. SERVEC  LONG    GET
  5622.         LONG    PUT
  5623.         LONG    KST
  5624.         LONG    TST
  5625. *
  5626. SSTACK  LONG    SS_SIZE
  5627. *
  5628. *============== GET:
  5629. *
  5630. *  Get's charter in life is to input characters from the user default
  5631. *  i/o device.  Get is also a hook into ADVANCE, telling ADVANCE where
  5632. *  and how to get characters from the user-supplied input device.
  5633. *
  5634. *  Entry conditions:
  5635. *
  5636. *       A0 = place where we put the input character
  5637. *
  5638. GET     MOVEM.L D1-D7/A0-A6,-(A7)
  5639.         MOVE.B  #INCHE,D7
  5640.         TRAP    #14
  5641.         AND.L   #$00FF,D0               REMOVE MOTO'S UPPER WORD GARBAGE;
  5642.         MOVEM.L (A7)+,D1-D7/A0-A6
  5643.         MOVE.L  D0,(A0)
  5644.         RTS
  5645. *
  5646. *============== PUT:
  5647. *
  5648. *  Put's charter in life is to output characters from the user default
  5649. *  i/o device.  Put is also a hook into ADVANCE, telling ADVANCE where
  5650. *  and how to get characters from the user-supplied output device.
  5651. *
  5652. *  Entry conditions:
  5653. *
  5654. *       D1 = character you want to output to the user-supplied device.
  5655. *
  5656. PUT     MOVEM.L D0-D7/A0-A6,-(A7)
  5657.         MOVE.L  D1,D0                   MOTO WANTS CHAR IN D0;
  5658.         AND.L   #$00FF,D0
  5659.         MOVE.L  #OUTCH,D7
  5660.         TRAP    #14
  5661.         MOVEM.L (A7)+,D0-D7/A0-A6
  5662.         RTS
  5663. *
  5664. *============== KST:
  5665. *
  5666. KST     ORI     #$01,CCR                Fake key status routine.
  5667.         RTS
  5668.  
  5669.  
  5670.  
  5671. Creative Software Technology Assembler Setup Examples     Page 5
  5672.  
  5673.  
  5674.  
  5675.  
  5676.  
  5677.     *** Advance Operating System Setup Examples ***
  5678.  
  5679.  
  5680. *
  5681. *============== TST:
  5682. *
  5683. TST     ORI     #$01,CCR                Fake trans_stat routine.
  5684.         RTS
  5685. *
  5686. *============== REGRESSION TESTER STARTS HERE:
  5687. *
  5688. START   LEA.L   INIT(PC),A0
  5689.         MOVE.L  A0,TRAP0V
  5690.         TRAP    #0              GET INTO SUP MODE AND CONTINUE:
  5691. *
  5692. *  You must enter the ADVANCE OPERATING SYSTEM from the user mode.  We
  5693. *  are now in the 68000 supervisor mode (the supervisor bit is set = 1).
  5694. *
  5695. INIT    MOVE.W  (A7)+,D0                DISCARD SR
  5696.         MOVE.L  (A7)+,D0                DISCARD PC
  5697.         MOVE.L  #$1400,A0
  5698.         MOVE.L  A0,TRAP1V               INIT AOS SYSTEM CALL VECTOR;
  5699.         MOVE.L  #$1800,A0
  5700.         MOVE.L  A0,TRAP0V               INIT DISPATCH VECTOR;
  5701.         LEA.L   BPHT(PC),A0
  5702.         MOVE.L  A0,TRAP2V               INIT BREAKPOINT VECTOR;
  5703.         JUMP    $1000                   JUMP TO AOS/68K;
  5704. *
  5705. *============== Dummy task number 1:
  5706. *
  5707. *  VERY IMPORTANT:  All tasks wanting to use breakpoints must Post Mailbox.
  5708. *
  5709. DUMY1   LINK    A5,#-PSIZ       RESERVE SPACE ON STACK FOR INPUT COMMAND LINE;
  5710.         LEA.L   -MLFLAG(A5),A0
  5711.         LEA.L   -STATZ(A5),A1
  5712.         MOVE.W  #EMPTY,-MLFLAG(A5)
  5713.         MOVE.W  #LETTE,-MXLTRS(A5)      SETUP FOR "LETTE" LETTERS (WAS 2);
  5714.         MOVE.L  #POSTBX,D0
  5715.         TRAP    #1                      POST MAILBOX;
  5716. *
  5717.         MOVEA.L #$01A0,A0               MAKE IT EASY TO SEE REGISTERS ON STK;
  5718.         MOVEA.L #$01A6,A6
  5719.         MOVE.L  #$01D0,D0
  5720.         MOVE.L  #$01D7,D7
  5721. DMY15   TRAP    #0
  5722.         NOP
  5723.         ADDQ.L  #1,D5
  5724.         BRA.S   DMY15
  5725. *
  5726. *============== Dummy task number 2:
  5727. *
  5728. *  VERY IMPORTANT:  Post Mailbox.
  5729. *
  5730. DUMY2   LINK    A5,#-PSIZ       RESERVE SPACE ON STACK FOR INPUT COMMAND LINE;
  5731.         LEA.L   -MLFLAG(A5),A0
  5732.         LEA.L   -STATZ(A5),A1
  5733.         MOVE.W  #EMPTY,-MLFLAG(A5)
  5734.  
  5735.  
  5736.  
  5737. Creative Software Technology Assembler Setup Examples     Page 6
  5738.  
  5739.  
  5740.  
  5741.  
  5742.  
  5743.     *** Advance Operating System Setup Examples ***
  5744.  
  5745.  
  5746.         MOVE.W  #LETTE,-MXLTRS(A5)      SETUP FOR "LETTE" LETTERS (WAS 2);
  5747.         MOVE.L  #POSTBX,D0
  5748.         TRAP    #1                      POST MAILBOX;
  5749. *
  5750.         MOVEA.L #$02A0,A0
  5751.         MOVEA.L #$02A6,A6
  5752.         MOVE.L  #$02D0,D0
  5753.         MOVE.L  #$02D7,D7
  5754. DMY25   TRAP    #0
  5755.         NOP
  5756.         ADDQ.L  #1,D6
  5757.         BRA.S   DMY25
  5758. *
  5759. *%%%%%%%%%%%%%% END OF EXAMPLE APPLICATION PROGRAM %%%%%%%%%%%%%%
  5760. *
  5761. *
  5762. *================================================================
  5763. *                                                               =
  5764. *               Beginning of Interactive Diagnostic Module      =
  5765. *                                                               =
  5766. *================================================================
  5767. *
  5768. IDM     BRA     IDM2            JUMP TO MAIN IDM CODE;
  5769. *
  5770. *  In order to use the AOS breakpoint feature, System Architects simply
  5771. *  point TRAP #2 to this next, known location:
  5772. *
  5773. BPHT    BRA     BPH             NEVER CHANGE THIS VECTOR
  5774. *
  5775. REVISED .BYTE   '0102MEASAAAABCIG'
  5776.         .BYTE   'AAABCREA230SAZ99'
  5777. *
  5778. CPYWRTE .BYTE   '  ADVANCE OPERATING SYSTEM '
  5779.         .BYTE   '(C) COPYRIGHT 1987 BY '
  5780.         .BYTE   'CREATIVE SOFTWARE TECHNOLOGY '
  5781.         .BYTE   'P.O.BOX 1856 '
  5782.         .BYTE   'CHANDLER, ARIZONA 85226-1856 '
  5783.         .BYTE   'ALL RIGHTS RESERVED '
  5784. *
  5785. IDM2    LINK    A6,#-PSIZE      RESERVE SPACE ON STACK FOR INPUT COMMAND LINE;
  5786.         MOVEA.L A6,A5
  5787.         BSR     INITZ
  5788.         BSR     CLRALL          CLEAR ALL BREAKPOINTS;
  5789. *
  5790. *  VERY IMPORTANT:  Post Mailbox.
  5791. *
  5792.         LEA.L   -ML_FLAG(A5),A0
  5793.         LEA.L   -STAT(A5),A1
  5794.         MOVE.W  #EMPTY,-ML_FLAG(A5)
  5795.         MOVE.W  #LETTERS,-MX_LTRS(A5)
  5796.         MOVE.L  #POSTBX,D0
  5797.         TRAP    #1
  5798. *
  5799.  
  5800.  
  5801.  
  5802.  
  5803. Creative Software Technology Assembler Setup Examples     Page 7
  5804.  
  5805.  
  5806.  
  5807.  
  5808.  
  5809. Advance Operating System                              Appendix A
  5810.  
  5811.  
  5812.             ADVANCE OPERATING SYSTEM EXECUTION TIMES
  5813.  
  5814.      The  timing information in this Appendix in given to  assist 
  5815. engineers and programmers in the development of application  pro-
  5816. grams  for the ADVANCE OPERATING SYSTEM.   The timing information 
  5817. given in this appendix is based upon an average 68000 system with 
  5818. eight registered tasks.  The 68000 is running under the following 
  5819. conditions:
  5820.  
  5821. 1)   Processor clock frequency is 8MHz.
  5822. 2)   No wait states are incurred in ROM or RAM accesses.
  5823. 3)   No user extension code is present.
  5824. 4)   Calls are made from assembly language.
  5825. 5)   Dynamic RAM refresh time is not included.
  5826.  
  5827. Four  of  the eight registered tasks are in the  active  dispatch 
  5828. queue  and four are inactive.   The cases selected for each  call 
  5829. are  not the best for performance.   System designers can achieve 
  5830. better  times than the execution times in this appendix.   It  is 
  5831. also possible under certain conditions,  however,  to exceed  the 
  5832. times  listed below for various conditions.   The selected  cases 
  5833. may or may not be representative of what a particular application 
  5834. will encounter.
  5835.  
  5836. Note:  System designers do not have to add in task switching time 
  5837. to any of the following execution times.   Included in all of the 
  5838. execution  times is the time it takes to switch to the next task.  
  5839. All timing figures are given in microseconds.
  5840.  
  5841. task_switch:  Execute a simple task 
  5842. switch.  No user hooks are present.  
  5843. This  is the execution time of  the 
  5844. Entry TWO task switch routine................................73.5
  5845.  
  5846. task_switch:  Execute a task switch 
  5847. and  supply  hooking mechanism  for 
  5848. executing user-supplied  code.   Do 
  5849. not  include  the time it takes  to 
  5850. execute the user code itself.  This 
  5851. is the execution time of the  Entry 
  5852. THREE task switch routine....................................86.1
  5853.  
  5854. tsk_on:   Turn  on  any  registered 
  5855. task in the inactive dispatch queue...........................247
  5856.  
  5857. tsk_off:   Turn  off any registered 
  5858. task in the active dispatch queue.............................334
  5859.  
  5860. tsk_stat:   Get  the status of  any 
  5861. registered task (on/off)......................................181
  5862.  
  5863. tsk_id:  Get the task number of any 
  5864. calling task..................................................154
  5865.  
  5866.  
  5867.  
  5868.  
  5869. Copyright (C) 1986, 1987 by Creative Software Technology     A-1
  5870.  
  5871.  
  5872.  
  5873.  
  5874.  
  5875. Advance Operating System                              Appendix A
  5876.  
  5877.  
  5878.  
  5879. post_box:  Post the mail box of any 
  5880. registered task...............................................207
  5881.  
  5882. send:    Send  a  message  to   any 
  5883. registered  active  task (that  has 
  5884. already  posted it's  mailbox  with 
  5885. AOS)..........................................................296
  5886.  
  5887. send:  Send a message to any regis-
  5888. tered  inactive task (that has  al-
  5889. ready posted it's mailbox with AOS) 
  5890. and turn on the inactive task.................................415
  5891.  
  5892. Both  of  the  "receive"  execution 
  5893. times include the "tsk_off"  execu-
  5894. tion   time  because  system   call 
  5895. "receive" calls tsk_off:
  5896.  
  5897. receive:   Make  a call to  receive 
  5898. and  allow a message from any  task 
  5899. to turn you back on again.....................................378
  5900.  
  5901. receive:   Make  a call to  receive 
  5902. and let only one specific task turn 
  5903. you back on again.............................................439
  5904.  
  5905. time_set:   Simply  set the  system 
  5906. time parameter................................................139
  5907.  
  5908. time_read:   Simply read the system 
  5909. time parameter................................................140
  5910.  
  5911. tick:   Update  the real-time clock 
  5912. by a single unit of time and decre-
  5913. ment  delays if  present.   Do  not 
  5914. turn on any tasks.............................................156
  5915.  
  5916. tick:   Update  the real-time clock 
  5917. by  a  single  unit  of  time   and 
  5918. decrement delays if present.  Also, 
  5919. turn on a task that has timed out.............................295
  5920.  
  5921. delay:  Make a call to delay.  This 
  5922. time includes (task switching  time 
  5923. and) a call to tsk_off........................................381
  5924.  
  5925. read_character:   Read in a charac-
  5926. ter  from the  user-supplied  input 
  5927. device.   Do not include any execu-
  5928. tion time for user code.......................................162
  5929.  
  5930.  
  5931.  
  5932.  
  5933.  
  5934.  
  5935. Copyright (C) 1986, 1987 by Creative Software Technology     A-2
  5936.  
  5937.  
  5938.  
  5939.  
  5940.  
  5941. Advance Operating System                              Appendix A
  5942.  
  5943.  
  5944. put_character:   Put a character to 
  5945. the  user-supplied  output  device.  
  5946. Do  not include any execution  time 
  5947. for user code.................................................161
  5948.  
  5949. key_stat:   See  if a character  is 
  5950. ready at the default  user-supplied 
  5951. input device..................................................171
  5952.  
  5953. trn_stat:   See if default i/o dev-
  5954. ice is ready to transmit......................................171
  5955.  
  5956. get_config:   Get a pointer to  the 
  5957. configuration table...........................................131
  5958.  
  5959. get_sys_stack:   Get  the value  of 
  5960. the system stack pointer......................................132
  5961.  
  5962.  
  5963. Note:   The "Return Quick" version (rq_tsk_on,  etc)  of  AOS/68K 
  5964.         commands  have approximately the same execution times  as 
  5965.         their non-return quick version.
  5966.  
  5967.  
  5968.  
  5969.  
  5970.  
  5971.  
  5972.  
  5973.  
  5974.  
  5975.  
  5976.  
  5977.  
  5978.  
  5979.  
  5980.  
  5981.  
  5982.  
  5983.  
  5984.  
  5985.  
  5986.  
  5987.  
  5988.  
  5989.  
  5990.  
  5991.  
  5992.  
  5993.  
  5994.  
  5995.  
  5996.  
  5997.  
  5998.  
  5999.  
  6000.  
  6001. Copyright (C) 1986, 1987 by Creative Software Technology     A-3
  6002.  
  6003.  
  6004.  
  6005.  
  6006.  
  6007. Advance Operating System Ordering Information
  6008.  
  6009.  
  6010.      AOS  is distributed in the USEware format.  If you are going 
  6011. to USE it,  please check the appropriate box below and  enclose a  
  6012. check  or  purchase order.  If you find  the  program  unUSEable, 
  6013. please drop us a line telling us why.  If you pay for the program 
  6014. by  sending  in a signed Binary Software License Agreement with a 
  6015. check  or money order for the correct amount,  you will receive a 
  6016. copy of the Advance Operating System IDM (Interactive  Diagnostic 
  6017. Module) object code, a $395.00 value, at no additional charge, be 
  6018. added to our mailing list,  and be kept notified of new  releases 
  6019. and new utilities.
  6020.  
  6021.      Please  fill  out  the  following  Binary  Software  License 
  6022. Agreement and Order Form when registering your software:
  6023. -----------------------------------------------------------------
  6024.  
  6025.                 BINARY SOFTWARE LICENSE AGREEMENT 
  6026.  
  6027. Customer Name:___________________________________________________
  6028.  
  6029. Address:_________________________________________________________
  6030.  
  6031. License Number___________________________________________________
  6032.  
  6033. Creative Software Technology,  ("CST"),  P.O. Box 1856, Chandler, 
  6034. Arizona,  85244-1856,  and  the party who executes this Agreement 
  6035. ("Customer") are in complete agreement as follows:
  6036.  
  6037.      1.   The Software Programs.  The "Software Programs" consist 
  6038. of  binary object code for CST's computer programs ordered  under 
  6039. this Binary Software  License Agreement,   in CST's standard form 
  6040. and  format  at the time of which CST has the  Software  Programs 
  6041. delivered to the customer.   "Software Documentation" consists of 
  6042. the  user  manuals  and other related materials  which  are  made 
  6043. available by CST with the Advance Operating System Software.  All 
  6044. title,  right,  and interest in and to all non-embedded copies of 
  6045. the Advance Operating System Software and the Software Documenta-
  6046. tion  are  and shall at all times remain the sole  and  exclusive 
  6047. property of CST.  Customer acknowledges CST's representation that 
  6048. CST  is  the exclusive owner of all  intellectual  rights,  copy-
  6049. rights,  all  other rights and all versions of the Advance Opera-
  6050. ting System Software and Software Documentation.  
  6051.  
  6052.      2.    Grant of Licenses.   CST hereby grants to Customer and 
  6053. Customer hereby accepts:
  6054.  
  6055.      2.1   License  to Use.  A  non-exclusive,  and  transferable 
  6056. license  to use the Software Programs and the Software Documenta-
  6057. tion; and
  6058.  
  6059.      2.2   License to Make Permitted Number of Copies*.   A  non-
  6060. exclusive, personal, and non-transferable license, subject to the 
  6061. all of the conditions of Paragraph 3,  to copy the Advance Opera-
  6062. ting System Software Programs and embed no more than the  Permit-
  6063. ted Number of Copies* into,  and to distribute them  with,  other 
  6064. Customer  computer software or hardware having substantial  added 
  6065.  
  6066.  
  6067. Copyright (C) 1986, 1987 by Creative Software Technology     A-4
  6068.  
  6069.  
  6070.  
  6071.  
  6072.  
  6073. Advance Operating System Ordering Information
  6074.  
  6075.  
  6076. value.   Customer  may copy and distribute the Advance  Operating 
  6077. System Software Documentation in it's original,  unmodified,  ARC 
  6078. formatted form.
  6079.  
  6080.      2.3  Term of Licenses.  Unless earlier terminated in writing 
  6081. to Creative Software Technology, the Licenses granted above shall 
  6082. continue  perpetually from the date hereof.   Upon termination or 
  6083. expiration  of this Agreement,  Customer shall notify CST of  the 
  6084. reason for termination in writing.
  6085.  
  6086.      3.   Permitted  Copying.   Customer agrees that it will  not 
  6087. disassemble  the  Advance Operating System Software Programs  for 
  6088. the  purpose of obtaining a source listing.     Customer  has  no 
  6089. right  to  authorize  any one else to modify or  disassemble  the 
  6090. Advance Operating System software.  Customer may make the Permit-
  6091. ted  Number of Copies* if the Customer complies with each of  the 
  6092. following conditions:
  6093.  
  6094.      3.1  Ownership of Software.   Customer agrees that each non-
  6095. embedded copy of Software shall be the sole and exclusive proper-
  6096. ty of CST, except as provided by Paragraph 6.2 below;
  6097.  
  6098.      3.2  Proprietary Notices.  Customer shall, immediately after 
  6099. copying, securely affix a CST EPROM Labels containing CST's copy-
  6100. right  and  proprietary  notices to each and every  copy  of  the 
  6101. Software Programs.
  6102.  
  6103.      3.3  Record-Keeping.   Customer shall keep an account of the 
  6104. number  of  copies made of the Advance Operating System  Software 
  6105. Programs and the location of all copies in its possession.
  6106.  
  6107.      4.   Warranties.   CST  warrants that the Advance  Operating 
  6108. System  Software Program will perform substantially as  described 
  6109. in  the  Advance  Operating System User Manual,  except  for  the 
  6110. system  calls  described  in Chapter 3 of the  Advance  Operating 
  6111. System User Manual.   CST will,  at no extra charge, fix any bugs 
  6112. discovered in the Advance Operating System Software Programs  for 
  6113. one  year  after the shipment date and for each  additional  year 
  6114. during  which an Annual Update Service is purchased by  Customer. 
  6115. CST makes no other warranties,  either express of implied, inclu-
  6116. ding  any implied warranties of merchantability of fitness for  a 
  6117. particular   purpose.   Customer  is advised to test the  Advance 
  6118. Operating  System software program thoroughly before  relying  on 
  6119. it.   Customer  must assume the entire risk of using the  Advance 
  6120. Operating System Software Programs.   Neither CST nor anyone else 
  6121. who  has  been  involved  in the creation or  production  of  the 
  6122. Advance Operating System Software Programs or Software Documenta-
  6123. tion,  shall  be liable for indirect,  or  consequential  damages 
  6124. resulting  from their use.   Customer's sole remedy shall be cor-
  6125. rection  or replacement of the Advance Operating System  Software 
  6126. Program.
  6127.  
  6128.  
  6129.  
  6130.  
  6131.  
  6132.  
  6133. Copyright (C) 1986, 1987 by Creative Software Technology     A-5
  6134.  
  6135.  
  6136.  
  6137.  
  6138.  
  6139. Advance Operating System Ordering Information
  6140.  
  6141.  
  6142.      5.   Payment.   Customer  shall  fill  out  the  appropriate 
  6143. ordering form below, and pay CST the correct amount stated on the 
  6144. ordering  form for the Permitted Number of Copies* within 30 days 
  6145. of the ordering date.
  6146.  
  6147.      6.  Indemnity by CST.  CST shall indemnify and hold Customer 
  6148. harmless  from any claim that the Advance Operating System  Soft-
  6149. ware  Programs or Software Documentation violate  someone  else's 
  6150. patent  or  copyright  if Customer (a) gives CST  prompt  written 
  6151. notice  of  any and all claims,  and (b) provides  CST  with  the 
  6152. information,  authority,  and  assistance  CST  deems  reasonably 
  6153. necessary  for  its  defense.   In the event use of  the  Advance 
  6154. Operating System Software Programs are enjoined,  CST  shall,  in 
  6155. its  sole discretion and at its own expense,  either (i)  procure 
  6156. the  right  for  continued use,  (ii) provide  the  modifications 
  6157. necessary  to make use non-infringing,  or (iii) refund  Customer 
  6158. for the amount paid under this Agreement for Permitted Number  of 
  6159. Copies* whose use is enjoined.
  6160.  
  6161.      7.   General.   This Agreement shall be governed by the laws 
  6162. of  the State of Arizona and/or applicable federal law.   If part 
  6163. of this Agreement is found to be invalid by a court of  competent 
  6164. jurisdiction, the remaining provisions shall remain in full force 
  6165. and  effect.   Any  modifications  to this agreement must  be  in 
  6166. writing and signed by both parties.
  6167.  
  6168. IN WITNESS WHEREOF,  the parties have executed this Agreement  as 
  6169. of the date written below.
  6170.  
  6171. Signed: ____________________________ Date: ___________ (Customer)
  6172.  
  6173. Title:  ____________________________
  6174.  
  6175.  
  6176. Signed: ____________________________ Date: ___________ (CST)
  6177.  
  6178. Title:  ____________________________
  6179.  
  6180.  
  6181.  
  6182.  
  6183.  
  6184.  
  6185.  
  6186.  
  6187.  
  6188.  
  6189.  
  6190.  
  6191.  
  6192.  
  6193.  
  6194.  
  6195.  
  6196.  
  6197.  
  6198.  
  6199. Copyright (C) 1986, 1987 by Creative Software Technology     A-6
  6200.  
  6201.  
  6202.  
  6203.  
  6204.  
  6205. Advance Operating System Ordering Information
  6206.  
  6207.  
  6208. Single-Installation Order Form
  6209. ==============================
  6210. If  you are going to pay for a single copy,  use this  form.  The 
  6211. single  installation price is $995.00.  Arizona businesses please  
  6212. add  6.5%  sales tax.
  6213.  
  6214. Full Name:___________________________  1 copy @ $995.00=_________
  6215.  
  6216.                                        IDM source code =_________
  6217.  
  6218. Address  :___________________________ 6.5% Sales Tax   =_________
  6219.  
  6220.          :___________________________   Total Enclosed =_________
  6221.  
  6222. City, St.:____________________    ________  Zip:_________________
  6223.  
  6224.  
  6225. -----------------------------------------------------------------
  6226.  
  6227. Corporate Site License Order Form
  6228. =================================
  6229. If  you are going to be using multiple copies of AOS within  your 
  6230. company  at one site,  (5 mile radius from licensing party),  you 
  6231. need   only   pay   $995.00 for  the  first  copy  plus  $10  per 
  6232. additional copy.   We  have 45 day billing if you include a  P.O.
  6233. number instead of a check or money order.
  6234.  
  6235. Primary Corporate Contact for updates, etc.:
  6236.  
  6237. Full Name :_________________________   1 copy @ $995.00=_________
  6238.  
  6239.                    *Permitted Number of Copies @ $10.00=_________
  6240.  
  6241.                                        IDM source code =_________
  6242.  
  6243. Address   :_________________________    6.5% Sales Tax =_________
  6244.  
  6245.           :_________________________    Total Enclosed =_________
  6246.  
  6247. Department:_________________________   P.O. Number:______________
  6248.  
  6249. City, St. :_________________    _______     Zip:_________________
  6250.  
  6251. Authorized Signature:____________________________  Date:_________
  6252.  
  6253. Make checks payable to:
  6254. Creative Software Technology
  6255. P.O. Box 1856
  6256. Chandler, Az 85244-1856
  6257.  
  6258. Business Tel: (602) 961-0231    8:00 A.M. till 4:00 P.M.*  M-F
  6259. CST RBBS Tel: (602) 961-0231    4:00 P.M. till 6:30 P.M.*  M-F
  6260.  
  6261. * Phoenix, Arizona time.
  6262. Modem line is 300/1200 baud, 8 data bits, 1 stop bit, no parity.
  6263.  
  6264.  
  6265. Copyright (C) 1986, 1987 by Creative Software Technology     A-7
  6266.  
  6267.  
  6268.  
  6269.